Effettuare una richiesta

Autenticazione

Tutte le richiesta alle HTTP API necessitano di essere autenticate tramite 2 parametri passati in GET authKey e authSecret.

Questi parametri vanno valorizzati con i codici AUTH_KEY e AUTH_SECRET associati al tuo profilo su SmsHosting.it.

Visita la sezione gestione sicurezza API nella tua area privata per recuperare tali valori.

Puoi testare le tue credenziali chiamando semplicemente da browser il seguente URL:

https://api.smshosting.it/rest/api/smart/user?authKey=[AUTH_KEY]&authSecret=[AUTH_SECRET]

oppure eseguendo da shell Linux il comando

curl 'https://api.smshosting.it/rest/api/smart/user?authKey=[AUTH_KEY]&authSecret=[AUTH_SECRET]'

Nel caso l'autenticazione non vada a buon fine viene restituito l'errore HTTP 400.

Econding e Content-Type

Tutte le richieste alle HTTP API devono esssere encodate in UTF-8.

Scegliere il formato di risposta

Le REST API di SmsHosting.it possono restituire le infomazioni sia nel formato JSON (default) che XML.

Per ottenere la risposta nel formato desiderato utilizza l'header HTTP "Accept" nella tua richiesta.

- Accept:application/json per ottenere un JSON

curl -H "Accept: application/json" https://api.smshosting.it/rest/api/smart/user?authKey=[AUTH_KEY]&authSecret=[AUTH_SECRET]

- Accept:application/xml per ottenere un XML

curl -H "Accept: application/xml" https://api.smshosting.it/rest/api/smart/user?authKey=[AUTH_KEY]&authSecret=[AUTH_SECRET]

Continua la lettura con la sezione Gestire la risposta