NAV
REST > Overview

    Overview(Last Updated : 01/04/2017)

    REST API Headers (Authentication)

    Basic authentication is required to access the REST API. Authentication includes the Request URL and API key. The first step is to create a header that includes the Content-Type and X-Apikey. A sample of the required header parameters with their values are listed below.

    Example Request URL: http://api.trumpia.com/rest/v1/{username}/subscription

    Header Parameters

    Parameter Description
    Content-Type application/json
    X-Apikey Your API key (This can be found in the API Settings page after logging in.)

    Example value: 123456789abc1011

    Resource Information

    Response Formats JSON
    Allowed Methods PUT/GET/POST/DELETE
    URL http://api.trumpia.com/rest/v1/{user_name}/{api_call}
    {user_name} Your account username (this can be found in the Account Settings page after logging in.)
    {api_call} The respective API function you are using.

    REST Methods

    Method Description
    PUT Used to create a resource.
    GET Used to retrieve information.
    POST Used to update a resource.
    DELETE Used to delete a resource.

    Additional Features

    • PUSH Notifications : Instead of manually generating a GET Status Report, you can have results automatically sent to you once our system has finished processing your resource call.
    • Inbound Message : Our API allows two-way communication for mobile text messages. Our system will notify you when a keyword is texted and a reply has been sent in return.

    Handling Responses

    • Each API request has a response. A successfully processed request will return the response.
    • Checking a request_id: Using GET Report will display if an API request was successful.
    • For an efficient way of checking request_id’s, please use our PUSH Notifications feature.

    System Status Codes

    Our System status codes page allows you to easily reference our REST API status codes and their definitions.

    HTTP Status Codes

    Code Description
    200 OK
    403 Access to resource is forbidden
    404 Resource does not exist
    405 Method not allowed

    Sending your first message.

    Create a list → add subscription to a list(s) → send a message to a list or subscription
    1. Enter your API key. Be sure to save your API key by logging in to api.trumpia.com and going to Account → API Settings. You will find the API key and additional settings that can be used with your program.
    2. Create a header with two values:
      • Content-type: application/json
      • X-Apikey: {insert API key}
    3. Create a distribution list using PUT List.
      • Get the list_id from the status of the request.
    4. Add a subscription to the new distribution list you have created using PUT Subscription.
      • Get the subscription_id from the status of the request.
    5. Send a message to the distribution list or subscriptions with PUT Message.

    Please note that a request_id is immediately returned after submitting an API request. Check the request_id using GET Report or you can set up PUSH Notifications for an automated process.