Skip to content

Latest commit

 

History

History
138 lines (101 loc) · 4.17 KB

README.md

File metadata and controls

138 lines (101 loc) · 4.17 KB

MOMENTS API DOCUMENTATION

INTRODUCTION

The purpose of this API is to provide the list of NPIs that reach brand moment qualification criteria.

NPI LISTS

  1. Get Moment NPI's

All examples in this documentation use the curl command line tool: http://curl.haxx.se/ Note that for all statements including <username>:<password> and <client_secret> you will need to replace with your Life username and password and client_secret respectively.

IMPORTANT

The base URL for all API calls is the following:

https://lifeapi.pulsepoint.com/RestApi/

Potential Error codes

Code Description
400 BAD_REQUEST BAD_REQUEST
401 UNAUTHORIZED UNAUTHORIZED
403 FORBIDDEN FORBIDDEN
405 METHOD_NOT_ALLOWED METHOD_NOT_ALLOWED
408 REQUEST_TIMEOUT REQUEST_TIMEOUT
429 TOO_MANY_REQUESTS TOO_MANY_REQUESTS
500 INTERNAL_SERVER_ERROR INTERNAL_SERVER_ERROR

MOMENTS API ENDPOINT

1. Get Moments NPI's

This endpoint allows clients to retrieve a list of all NPIs that are currently part of a Moment. You will need to have the Moments List ID in order to retrieve its corresponding NPI’s.

GET

ENDPOINT

/v1/npi/npi-list/{listID}

SAMPLE RESPONSE

{
  "id": 4210,
  "npis": [
    "1234567891",
    "1234567892",
    "1234567893",
    "1234567894",
    "1234567895",
    "123 4567896",
    "1234567897"
  ],
  "name": "NPI_4210",
  "advertisers": ["Demo"]
}
Error Code Description
400 Bad Request You do not have permission to view this Smart List.
429 Too many requests Server has received too many requests
REQUEST EXAMPLES
Below are a list of code examples for CURL, Python, Java and JavaScript

CURL

curl --location 'https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/33388' \
--header 'Authorization: Bearer <token>'

PYTHON

import requests

url = "https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/33388"

headers = {
  'Authorization': 'Bearer <token>'
}

response = requests.request("GET", url, headers=headers)

print(response.text)

JAVA

OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
  .url("https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/33388")
  .method("GET", body)
  .addHeader("Authorization", "Bearer <token>")
  .build();
Response response = client.newCall(request).execute();

JAVASCRIPT

const myHeaders = new Headers()
myHeaders.append('Authorization', 'Bearer <token>')

const requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow',
}

fetch(
  'https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/33388',
  requestOptions,
)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.error(error))