/<instance_id>/links - POST

Method description

Create a new link for the client  {instance_id}.

URI Parameters

None

Requests

Body
application/json

Get Token

Get the token to connect with the user service.

User Service Token
curl --request POST \
  --url https://api.empathybroker.com/user/v1/user/login \
  --header 'Content-Type: application/json' \
  --data '{
	"user": "",
	"password": ""
}'

Direct Link

Example application/json
{
  "activation_date": null,
  "created_on": "2017-08-08T15:27:43",
  "deactivation_date": null,
  "enabled": true,
  "keywords": [
      "raffle"
  ],
  "lang": "en",
  "match_all": false,
  "title": "Raffle",
  "type": "DIRECT",
  "url": "https://empathybroker.com/raffle",
  "weight": 0
}

Banner Link

Example application/json
{
  "activation_date": null,
  "deactivation_date": null,
  "enabled": true,
  "keywords": [
      "raffle"
  ],
  "lang": "en",
  "match_all": false,
  "title": "Raffle",
  "image_url": "unnamed.png",
  "type": "BANNER",
  "url": "https://empathybroker.com/raffle",
  "weight": 0
}

image_url in BABBER and PROMOTED links

To add the url image it is necessary to add an image through the following information Empathy Play Api - Post image.


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
{
  "activation_date": null,
  "created_on": "2017-08-08T15:27:43",
  "deactivation_date": null,
  "enabled": true,
  "extra": {
    "user": "-"
  },
  "id": "5989d86fe6ece90012a92766",
  "image_url": null,
  "keywords": [
      "raffle"
  ],
  "lang": "en",
  "match_all": false,
  "title": "Raffle",
  "type": "DIRECT",
  "updated_on": "2017-08-08T15:27:43",
  "url": "https://empathybroker.com/raffle",
  "weight": 0
}

Also, a Location header will point to the URL for the link 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"
}