12. Keywords

GET /keywords.{format}

Gets all keywords for the user. 

GET /keywords.json
{
  "keywords": [
    {
      "id": "6515641",
      "keyword": “PILEFLET”,
      "function": "http",
      "number": "1272",
      "category": "13",
      "mainkeyword": "0",
      "serviceid": "28205",
      "frameworkaccept": "1",
      "statusurl": null,
      "state": "reserved"
    },
    {
      "id": "10281329",
      "keyword": “VANDFLASKE”,
      "function": "smsinbox",
      "number": "1272",
      "category": "9",
      "mainkeyword": "0",
      "service": null,
      "serviceid": "65797",
      "frameworkaccept": "1",
      "statusurl": null,
      "state": "reserved"
    },
  ],
  "status": 200
}

GET /keywords/{number}/{keyword}.{format}

Gets a specific keyword on a specific number .

{
  "keyword": {
    "id": "10283609",
    "keyword": "KONKURRENCE",
    "function": "subkeyword",
    "number": "1272",
    "category": "13",
    "mainkeyword": "0",
    "service": null,
    "serviceid": "0",
    "frameworkaccept": "1",
    "statusurl": null,
    "state": "reserved"
  },
  "status": 200
}


If accessing a keyword, that is inaccessible, then a 404 - NOT FOUND will be issued.

GET /keywords/1272/hello.json - 404 NOT FOUND
{
  "status": 404,
  "message": "Keyword [HELLO] was not found on number [1272]"
}

GET /keywords/{id}.{format}

Gets a specific keywords, based on id

{
  "keyword": {
    "id": "10301793",
    "keyword": "KUGLEPEN",
    "function": "contest",
    "number": "1272",
    "category": "8",
    "mainkeyword": "0",
    "serviceid": "1045",
    "frameworkaccept": "1",
    "statusurl": null,
    "state": "reserved"
  },
  "status": 200
}

If accessing a keyword, that is inaccessible, then a 404 - NOT FOUND will be issued.

GET /keywords/1272/hello.json - 404 NOT FOUND
{
  "status": 404,
  "message": "Keyword [HELLO] was not found on number [1272]"
}


POST /keywords.{format}

Reserves a new keyword on a given number. 

Fields:

NameDescriptionRequired
numberWhich shortcode the keyword must be created on. The user must have access to this shortcode.Yes
keywordWhich keyword that should be reservedYes
mainkeywordIf the keyword is a subkeyword of another keyword, this should contain the id of the main keyword.No


POST /keywords
{
	"number":"1272",
	"keyword":"papirhat"
}

Response - OK

{
  "keyword": {
    "id": "10305133",
    "keyword": "PAPIRHAT",
    "function": "",
    "number": "1272",
    "category": "0",
    "mainkeyword": "0",
    "service": null,
    "serviceid": "0",
    "frameworkaccept": "0",
    "statusurl": null,
    "state": "reserved"
  },
  "status": 201
}

Response - Error

If anything goes wrong (e.g. the user does not have access to the given shortcode or the keyword is already taken on the shortcode), then a 4XX will be issued

{
  "message": "User cannot access number [1919]",
  "status": 401
}
{
  "message": "Keyword [PAPIRHAT] is already taken on [1272]",
  "status": 400
}

DELETE /keywords/{id}.{format}

Deletes a keyword, by a given id. The attached service will not be deleted.

Response - OK

If the keyword is deleted successfully, then a 200 OK will be returned along with the deleted keyword. The keyword will remain assigned to the number/user for the remainder of the running month, but it will be internally flagged for deletion.

Delete OK
{
  "keyword": {
    "id": "10305133",
    "keyword": "PAPIRHAT",
    "function": "",
    "number": "1272",
    "category": "0",
    "mainkeyword": "0",
    "service": null,
    "serviceid": "0",
    "frameworkaccept": "0",
    "statusurl": null,
    "state": "reserved"
  },
  "status": 201
}

Response - Error

If an error happens, a 4XX will be returned along with a message about what went wrong

Delete - Error
{
  "message": "Keyword [1234] was not found",
  "status": 404
}

Feeling lost? Click on this link! Portal page