/<instance_id>/blacklists - POST

Method description

Create a new blacklist item for the client {instance_id}.

URI Parameters

None

Requests

Body
application/json
Example application/json
{
  "lang": "ES",
  "terms": ["prueba 1 ES","prueba 2 ES"]
}

See Empathy Play API - Models for details. All non-optional fields must be included in the request.

Responses

201 - item has been created

Type: application/json

Example application/json
{
    "ignored": [
    	{
            "created_on": "2017-07-10T18:35:30",
            "id": null,
            "lang": "ES",
            "terms": "prueba 5 ES",
            "updated_on": null
        }
    ],
    "saved": [
        {
            "created_on": "2017-07-07T12:08:57",
            "id": "595f79d9f9cddab1c8170d45",
            "lang": "ES",
            "terms": "prueba 1 ES",
            "updated_on": "2017-07-07T12:08:57"
        },
        {
            "created_on": "2017-07-07T12:08:58",
            "id": "595f79daf9cddab1c8170d46",
            "lang": "ES",
            "terms": "prueba 2 ES",
            "updated_on": "2017-07-07T12:08:58"
        },
        {
            "created_on": "2017-07-07T12:08:58",
            "id": "595f79daf9cddab1c8170d47",
            "lang": "ES",
            "terms": "prueba 3 ES",
            "updated_on": "2017-07-07T12:08:58"
        },
        {
            "created_on": "2017-07-07T12:08:58",
            "id": "595f79daf9cddab1c8170d48",
            "lang": "ES",
            "terms": "prueba 4 ES",
            "updated_on": "2017-07-07T12:08:58"
        }
    ]
}

When a blacklist is successfully created, the response will contain the a list of blacklist items saved and a list of blacklist items ignored.

Also, a Location header will point to the URL for the blacklist item that was just created.

400 - Invalid parameters. Error response will include details

Type: application/json

Example application/json
{
  "code": "validation_error",
  "details": [
    {
      "message": "1 is not of type 'boolean'",
      "path": ".enabled"
    }
  ],
  "message": "Error validating JSON",
  "status": "error"
}
401 - the user performing the action doesn't meet the security criteria

Type: application/json

Example application/json
{
  "code": 401,
  "details": "The server could not verify that you are authorized to access the URL requested.  You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.",
  "message": "Unauthorized",
  "status": "error"
}