Create an Action

post

/action

Creates a new action.

Request

There are no request parameters for this operation.

Back to Top

Response

201 Response

The action was created successfully.
Back to Top

Examples

The following example shows how to create a new action by submitting a POST request on the REST resource using cURL. For more information about cURL, see "Use cURL".

The -d option specifies the file to attach as the request body.

curl -X POST "hostname:port/action" -H "accept: */*" -H "Content-Type: application/json" -d @file.json

where:

  • file.json is the JSON file the action details to create.

Example of Request Body

The following is an example of the contents of file.json sent as the request body:

{
  "tags": [
    "todo",
    "read"
  ],
  "name": "Add one todo task",
  "description": "Add one todo task",
  "bdd": "add todo task xzVIxDptygdprFk",
  "product": "todo",
  "actionType": "API",
  "subType": "REST",
  "path": "TodoApp/add-todo-tasks/add-one-todo-task",
  "request": "add-one-todo-task.request.json",
  "requestType": "FILE",
  "expectedStatusCode": 200,
  "requestString": "{\r\n    \"name\" : \"Buy 2L Milk\",\r\n    \"description\" : \"Buy 2L milk from nandini booth\"\r\n}\r\n",
  "resource": "todo",
  "method": "POST",
  "queryParameters": null
}

Example of Response Body

If successful, the response code 201 is returned along with a header. For example:

{
  "id": "180"
}

If the request fails, the response includes the appropriate HTTP code. For a 4xx/5xx code, the message body also contains a ProblemDetails structure with the cause attribute set to the appropriate application error.

Back to Top