1. Home
  2. API & Integrations
  3. Get Started with API

Get Started with API

API basics

For each API request, in order to guarantee security we require you add 3 parameters:

  1. Key: Your API key
  2. Request-time: Current datetime in RFC-3339 Format e.g. ‘2016-02-02T16:40:50+05:30
  3. Signature: Hashed string value to verify authenticity
  4. Recommended to use TLS 1.2 protocol while making API requests
  5. We have tested with openssl 1.0.1+ version

API key and secret key is available in the api section of the platform :

Screen Shot 2017-03-10 at 5.15.39 PM

 

How to Generate a Signature

Signature is basically Hmac hexdigest of API endpoint and request time.

For example, for a Pepo Campaigns api request like https://pepocampaigns.com/api/v1/list/8/add-contact/ , the Signature is calculated as concatenation of the following elements:

  1. url = /api/v1/list/8/add-contact/
  2. delimiter : ‘::’
  3. request-time = ‘2016-02-02T16:40:50+05:30’

string-to-sign = url + delimiter + request time

generated-signature = Hmac_Sha256_Hexdigest(string-to-sign, api-secret)

Final API URL

Once the generated-signature string is generated, it is possible to compose the final API URL:

https://pepocampaigns.com/api/v1/list/8/add-contact/?api-key=your-key&signature=generated-signature&request-time=2016-02-02T16:40:50+05:30

Please ensure that you encode the final URL while making the API request.

Below you can find some code examples in Ruby, Java ,Python and C#:

Java

Python

Ruby

Ruby Github Library

C#

PHP

PHP Github Library

Requests

  1. All requests should be made using HTTPS.
  2. All parameters are required unless otherwise specified.

Response

  1. Data returned in JSON.
  2. Any non-200 HTTP response code can be considered an error.

General Errors

  1. Authentication Error: Occurs when key/signature is invalid
  2. Authorization Error: Given User is not authorized to perform requested action
  3. Validation Error: One or more parameters are not valid
  4. Basic Error: Something went wrong. Should retry after sometime

Ruby on Rails code example

Updated on May 2, 2017

Related Articles