13 - Services

Types

It is currently only possible to work with the servicetype "http".

HTTP:

A service of the type http will forward the message to a given url by POST'ing it. The message will contain 3 request headeres along with the same 3 request paramters.

NameContentType
SMSThe full incoming message with the keywordString
FROMThe sender with prefix, but not + (e.g. 4512345678)Number
NUMBERThe shortcode, the message has been sent toNumber


GET /services/{type}.{format}

Returns a list of services available to the user of the given type.

GET /services
curl 'http://api.linkmobility.dk/v2/services/http.{format}?apikey=[apikey]' -X GET

Response

GET /services/http
{
  "services": [
    {
      "id": "28205",
      "url": "http://www.test.com/incoming",
      "continuous": "0",
      "charset": ""
    },
    {
      "id": "31557",
      "url": "http://domain.dk/test",
      "continuous": "0",
      "charset": ""
    }
  ],
  "status": 200
}

POST /services/{type}.{format}

Creates a new service, that can be attached to a given keyword. 

curl 'http://api.linkmobility.dk/v2/services/http.json?apikey=[apikey]' -H "Content-Type: application/json" -X POST -d @file.json

Payload file.json

file.json
{
	"url":"http://www.test.com/incoming"
}

Fields:

NameTypeDescriptionRequired
urlstringA valid url the message must be forwarded toYes
charsetstringIf the message must be sent in a specific charset, then set it hereNo


PUT /services/{type}/{id}.{format}

Updates a service given by type and id


curl 'http://api.linkmobility.dk/v2/services/http/{id}.json?apikey=[apikey]' -H "Content-Type: application/json" -X PUT -d @file.json

Payload file.json

file.json
{
	"url":"http://www.test.com/incoming"
}

Response - OK

If the update is ok, then a 200 OK will be returned, along with the updated object. 

Response OK
{
  "service": {
    "id": "52533",
    "url": "http://www.test.com/incoming",
    "continuous": "1",
    "charset": "utf-8"
  },
  "status": 200
}

Response - Error

If the update fails, then the system will response with a 4XX and a message to explain what was wrong.

{
  "status": 400,
  "message": "Url cannot be empty"
}


Feeling lost? Click on this link! Portal page