Get Started with the Wire2Air REST API
Review the following information to get started with the Wire2Air REST API.
- How to obtain the API credentials
- The API endpoint
- How the REST API works
- Response Codes
How to obtain the API credentials
Follw the steps given below to create a new API key.
- Log-in to the Wire2Air dashboard
- Go to Manage Account –> Manage API Keys
- Click the Generate New API Key button.
- Enter a Name for this key. Note, it’s just a label, so pick any name.
- Click Copy to Clipboard Icon, To copy the API-Key to a clipboard.
- Click the Save Changes button.
- You should now see “API Key saved successfully” message above the table, And now you can paste APIKey from the clipboard.
How to use an API Key
Your API key may be passed to the service in a few different ways. Pick whichever method is easiest for you.
HTTP Header
Pass the API key into the apikey header:
curl -H 'apikey: DEMO_KEY' --data 'to=12123005984&from=27126&text=Test Message' 'https://msgapi.wire2air.com/rest/v1/message'
GET Query Parameter
Pass the API key into the apikey GET query string parameter:
Your program sends the login credentials with each API request as HTTP header: APIkey or a GET Query Parameter.
curl -H 'apikey: DEMO_KEY' --data 'to=12123005984&from=27126&text=Test Message' 'https://msgapi.wire2air.com/rest/v1/message?apikey=DEMO_KEY'
All the URLs referenced in this documentation should use this base URL.
How the REST API works
REST APIs are based on the HTTP protocol to send and receive data from cloud/web hosted third-party applications. REST is a protocol or standard, it is an architectural style. You make client-side requests (from a website/application) to this API to create, update, delete or get data. REST API can return data that you need for your application in a convenient format (e.g. JSON or XML).
REST relies heavily on HTTP. Each operation uses its own HTTP method:
- GET – getting;
- POST – creation;
- PUT – update (modification);
- DELETE – removal.
All these methods (operations) are generally called CRUD. They manage data or as “create, read, update and delete” it.
Example:
Let’s take the entity most often used in messaging: Subscribers Imagine you want to perform operations on your Subscribers list: well, it’s only a matter of calling the following endpoints:
- GET rest/v1/campaign/{campaignid}/subscribers (get all of your contacts)
- GET rest/v1/campaign/{campaignid}/subscribers{id} (get a specific contact)
- POST rest/v1/campaign/{campaignid}/subscribers (create a new contact)
- PUT rest/v1/campaign/{campaignid}/subscribers{id} (update an existing contact)
- DELETE rest/v1/campaign/{campaignid}/subscribers{id} (delete an existing contact)
HTTP Status Codes
200 | Success |
401 | Unauthorized – Authentication credentials are missing or incorrect |
400 | Bad Request– Request is not valid. An accompanying error message explains what’s missing. |
429 | API calls quota exceeded. |
500 | Internal Server Error – Contact support |
Application Error Format (HTTP Status code 400)
{ "StatusCode": 712, "StatusMessage": "Campaign Id required." }