Ajouter une règle¶
-
POST
/v2/rules
¶ Creates a new transfer rule with the ObjectRule passed in the request body. The created entry is returned in the response body, along with its URI.
Example request:
POST /v2/rules HTTP/1.1 Host: example.com Content-Type: application/json { "name": "string", "hostIds": [ "string" ], "modeTrans": "send", "recvPath": "string", "sendPath": "string", "archivePath": "string", "workPath": "string", "rPreTasks": [ { "type": "LOG", "arguments": "string", "delay": 1 } ], "rPostTask": [ { "type": "LOG", "arguments": "string", "delay": 1 } ], "rErrorTasks": [ { "type": "LOG", "arguments": "string", "delay": 1 } ], "sPreTasks": [ { "type": "LOG", "arguments": "string", "delay": 1 } ], "sPostTasks": [ { "type": "LOG", "arguments": "string", "delay": 1 } ], "sErrorTasks": [ { "type": "LOG", "arguments": "string", "delay": 1 } ] }
- Status Codes
La nouvelle règle de transfert a été ajoutée avec succès.
Example response:
HTTP/1.1 201 Created Content-Type: application/json { "name": "string", "hostIds": [ "string" ], "modeTrans": "send", "recvPath": "string", "sendPath": "string", "archivePath": "string", "workPath": "string", "rPreTasks": [ { "type": "LOG", "arguments": "string", "delay": 1 } ], "rPostTask": [ { "type": "LOG", "arguments": "string", "delay": 1 } ], "rErrorTasks": [ { "type": "LOG", "arguments": "string", "delay": 1 } ], "sPreTasks": [ { "type": "LOG", "arguments": "string", "delay": 1 } ], "sPostTasks": [ { "type": "LOG", "arguments": "string", "delay": 1 } ], "sErrorTasks": [ { "type": "LOG", "arguments": "string", "delay": 1 } ] }
La requête est invalide, soit à cause de paramètres de requête erronés, soit à cause d’un corps de requête invalide.
Les causes de l’échec de la requête sont données dans le corps de la réponse sour forme d’un tableau JSON.
Example response:
HTTP/1.1 400 Bad Request Content-Type: application/json { "errors": [ { "message": "Query parameter 'startTrans' : illegal value 'not_a_date'.", "errorCode": 4 }, { "message": "Query parameter 'status' : illegal value 'not_a_status'.", "errorCode": 4 } ] }
- Response Headers
ruleURI – L’URI d’accès à la nouvelle règle créée.