icon_qa

INTRODUZIONE API REST

MAKING CALLS

Authentication

All requests to the REST API need to be authenticated through the HTTP Basic authentication.

All requests require your API credentials (AUTH_KEY,AUTH_SECRET), which you can find under "security management API" in SmsHosting.it Dashboard:

Visit security management API in your private area to retrieve these values.

You can test your credentials simply by calling from browser the following URL:

https://AUTH_KEY:AUTH_SECRET@api.smshosting.it/rest/api/user

or running from the shell command

curl --user AUTH_KEY:AUTH_SECRET https://api.smshosting.it/rest/api/user

Into the case no authentication is successful it returns the HTTP 401 error .

Econding and Content-Type

All requests are submitted through the HTTP POST or GET method using UTF-8 encoding.

HTTP POST requests and HTTP PUT must set the value of a header Content-Type to application /x -www-form -urlencoded

Choose the response format

SmsHosting.it REST API can return the informations in JSON (default ) or XML format .

To get the answer in the desired format using the HTTP header "Accept" in your request.

- Accept: application/json to get a JSON

curl -H "Accept: application/json" --user AUTH_KEY:AUTH_SECRET https://api.smshosting.it/rest/api/user

- Accept: application /xml to get a XML

curl -H "Accept: application/xml" --user AUTH_KEY:AUTH_SECRET https://api.smshosting.it/rest/api/user

Continue reading handle response