SMS From Me

Automatically Start One on One SMS Conversations

REST API Replies

JSON

All REST replies are returning a JSON object with a few fields unless a server error (5XX) happens or a redirect (3XX) is requested.

In most cases, though, your calls do not generate an error and the HTTP code returned will be 200 or 201. (Note that at this time our Create functions return 200 instead of 201. We plan to change at some point to be closer to the REST specification.)

When no error occured, the returned JSON represents an object. It may represent a message, a subscription, a user (albeit always partial.) The following shows you an example of a message object as returned by the message interface:

{
  "message": {
    "id": "123",
    "destination": "9165551212",
    "message": "This is your text message",
    "created_on": "2017-08-01 15:18:22",
    "send_on": "2017-08-01 15:18:22",
    "status": "N",
    "status_date": "2017-08-01 15:18:22",
    "source": "api",
    "failure_count": 0
  },
  "links": {
    "list": {
      "method": "GET",
      "url": "https://smsfromme.com/api/1/message"
    },
    "next": {
      "method": "NEXT",
      "url": "https://smsfromme.com/api/1/message"
    },
    "new": {
      "method": "POST",
      "url": "https://smsfromme.com/api/1/message"
    },
    "get": {
      "method": "GET",
      "url": "https://smsfromme.com/api/1/message/123"
    },
    "edit": {
      "method": "PATCH",
      "url": "https://smsfromme.com/api/1/message/123"
    },
    "delete": {
      "method": "DELETE",
      "url": "https://smsfromme.com/api/1/message/123"
    },
    "success": {
      "method": "PUT",
      "url": "https://smsfromme.com/api/1/message/123/success"
    },
    "failure": {
      "method": "PUT",
      "url": "https://smsfromme.com/api/1/message/123/failure"
    }
  }
}

The links in such a JSON reply can be used by your software to further act on an object. For example, a message "success" link is used to mark the message as successfully sent over the phone telephony system.

Errors (4XX)

If an error occurs, then the HTTP code may be any 4XX code, although in most cases it will be 400.

The JSON returned when an error occurs is a standard REST error object:

{
  "error": "invalid_message",
  "error_description": "textual description of the error",
  "error_uri": "https://smsfromme.com/help/developers/rest-api/errors"
}

The errors are further explained in the REST API Errors page.

The error 403 also happens when you are logged in with a scope that does not give you access to the function you are trying to use. The API key and Secret key will give you the highest possible permission. The scope cannot yet properly be specified in the OAuth interface.

Low Level Server Error (5XX)

The server may encounter problems in which case errors returned are 5XX error and no JSON gets included. Actually, these errors are much more likely to return an HTML body with a JSON with a description of the error. Your client should recognize 5XX errors as server errors and not attempt to do any further determination of what the error is. You will be able to retrie the same request later as if nothing had happened.

Redirects (3XX)

As time passes, we may change our URLs. The old URLs will then redirect your requests to the new location. In most cases the sub-system you are using to access our REST API will automatically do the redirect for you. It is just a matter of you letting that happen. You may, however, want to limit the number of redirects to 2 or 3, more would not be sensible.

We may make use of 301, 302, 306, and 307 codes.

 

Login

 

Register

If you already registered with your email address and needed to re-validate (i.e. the first validation somehow failed) then go to the Validate Page where you can request for a new validation code to be emailed to you.

Login         Register         Get App.
 

Get My Free Book About SMS Marketing

Hey! Before you leave, make sure to get my freeBook About SMS Marketing. All you have to do is enter your email address and I'll send you a link to this website where you can retrieve your own copy of my free book.

Connect With Us
Google Plus Button
LinkedIn Button
YouTube Button