Skip to content

Latest commit

 

History

History
1208 lines (938 loc) · 39.4 KB

README.md

File metadata and controls

1208 lines (938 loc) · 39.4 KB

NPI LIST API DOCUMENTATION

INTRODUCTION

PulsePoint's clients use NPI lists for campaign targeting. These lists can change often and are customizable by each client. Clients now have direct access and complete control of their standard NPI lists and NPI lists with attributes via the NPI List API.

This document describes the functionality supported by the NPI List API. PulsePoint provides a REST API to access and manage the following actions for two different types of NPI lists:

NPI LISTS

  1. Get an NPIs lists
  2. Get all NPI list
  3. Create an NPI list
  4. Replace NPIs in a list
  5. Add NPIs into a list
  6. Delete NPIs from a list

NPI lists with attributes

  1. Create an NPI list with attributes
  2. Replace an NPI list with attributes
  3. View an NPI list with attributes

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.

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

NPI API ENDPOINTS, NPI ONLY LISTS

1. Get an NPI list

This endpoint allows clients to retrieve a list of all NPI's that are in a single NPI list.

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"]
}

If successful in your request the response will be similar to above with a 200. If your request fails it will return one of the following errors:

Error Code Description
400 Bad Request You do not have access to view this NPI List
400 Bad Request Unknown NPI list ID
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))

2. Get all NPI lists

This endpoint allows clients to get a list of all NPI lists associated with an account.

GET

ENDPOINT

/v1/npi/npi-list/account/{accountID}

SAMPLE RESPONSE

[
  {"id": 30, "advertisers": ["Demo"], "name": "NPI_Oncologist"},
  {"id": 38, "advertisers": ["Demo"], "name": "NPI_Cardiology"},
  {"id": 39, "advertisers": ["Demo"], "name": "NPI_Dermatology"}
]

If successful in your request the response will be similar to above with a 200. If your request fails it will return one of the following errors:

Error Code Description
400 Bad Request You do not have access to view this NPI List
400 Bad Request Unknown NPI list ID
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/account/561939' \
--header 'Authorization: Bearer <token>'

PYTHON

import requests

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

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/account/561939")
  .method("GET")
  .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/account/561939',
  requestOptions,
)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.error(error))

3. Create an NPI list

This endpoint allows clients to create a new NPI list and add NPIs to the new list.

POST

ENDPOINT

/v1/npi/npi-list/account/{accountid}

SAMPLE REQUEST

{
  "name": "Endocrinologist_2022_1",
  "npis": ["3137933127", "3134730121"],
  "advertisers": ["Demo"],
  "applications": ["LIFE"]
}

PLEASE_NOTE

The applications field accepts either [“LIFE”], [“SIGNAL”] or [‘SOCIAL”]. These are products used within Pulsepoint.

  • LIFE: Pulsepoints Buying platform
  • SIGNAL: HCP365
  • SOCIAL: ...

If successful in your request the response will return a 200. If your request fails it will return one of the following errors:

Error Code Description
400 Bad Request Invalid property name for post operation
400 Bad Request Invalid value(s) for "applications""
400 Bad Request NPI ID can not be empty
400 Bad Request Invalid NPI ID
400 Bad Request NPI ID can not exceed 10 characters
400 Bad Request "advertisers" is required
400 Bad Request 1Mn NPIs have been exceeded
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 --request POST 'https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/account/561939' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
  "name": "Endocrinologist_2023_1",
  "npis": ["3137933127", "3134730121"],
  "advertisers": ["Demo"],
  "applications"": ["LIFE"]
}'

PYTHON

import requests
import json

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

payload = json.dumps({
  "name": "Endocrinologist_2023_1",
  "npis": [
    "3137933127",
    "3134730121"
  ],
  "advertisers": [
    "Demo"
  ],
  "applications"": [
    "LIFE"
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

JAVA

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"name\": \"Endocrinologist_2023_1\",\n  \"npis\": [\"3137933127\", \"3134730121\"],\n  \"advertisers\": [\"Demo\"],\n  \"applications"\": [\"LIFE\"]\n}");
Request request = new Request.Builder()
  .url("https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/account/561939")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer <token>")
  .build();
Response response = client.newCall(request).execute();

JAVASCRIPT

const myHeaders = new Headers()
myHeaders.append('Content-Type', 'application/json')
myHeaders.append('Authorization', 'Bearer <token>')

const raw = JSON.stringify({
  name: 'Endocrinologist_2023_1',
  npis: ['3137933127', '3134730121'],
  advertisers: ['Demo'],
  applications: ['LIFE'],
})

const requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow',
}

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

4. Replace NPIs in a list

This endpoint allows clients to get a list of all NPI lists associated with an account.

PUT

ENDPOINT

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

SAMPLE REQUEST

{
  "npis": ["3137933120", "3134730121"]
}

If successful in your request the response will be similar to above with a returned a 200. If your request fails it will return one of the following errors:

Error Code Description
400 Bad Request Invalid property name for post operation
400 Bad Request Invalid value(s) for "applications""
400 Bad Request NPI ID can not be empty
400 Bad Request Invalid NPI ID
400 Bad Request NPI ID can not exceed 10 characters
400 Bad Request "advertisers" is required
400 Bad Request 1Mn NPIs have been exceeded
400 Bad Request Smart lists cannot be updated or deleted using the NPI List API.
400 Bad Request PulsePoint provided lists cannot be updated or deleted using the NPI List API
400 Bad Request List is archived and needs to be un-archived in order to be updated.
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 --request PUT 'https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/33388' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
  "npis": ["3137933120", "3134730121"]
}'

PYTHON

import requests
import json

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

payload = json.dumps({
  "npis": [
    "3137933120",
    "3134730121"
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <token>'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)

JAVA

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"npis\": [\"3137933120\", \"3134730121\"]\n}");
Request request = new Request.Builder()
  .url("https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/33388")
  .method("PUT", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer <token>")
  .build();
Response response = client.newCall(request).execute();

JAVASCRIPT

const myHeaders = new Headers()
myHeaders.append('Content-Type', 'application/json')
myHeaders.append('Authorization', 'Bearer <token>')

const raw = JSON.stringify({
  npis: ['3137933120', '3134730121'],
})

const requestOptions = {
  method: 'PUT',
  headers: myHeaders,
  body: raw,
  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))

5. Add NPIs to a list

This endpoint allows clients to add NPIs to an existing NPI list.

PATCH

ENDPOINT

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

SAMPLE REQUEST

{
  "operation": "add",
  "npis": ["3137933122", "3134730123"]
}

If successful in your request will return a 200. If your request fails it will return one of the following errors:

Error Code Description
400 Bad Request Invalid property name for post operation
400 Bad Request Invalid value(s) for "applications"
400 Bad Request NPI ID can not be empty
400 Bad Request Invalid NPI ID
400 Bad Request NPI ID can not exceed 10 characters
400 Bad Request "advertisers" is required
400 Bad Request 1Mn NPIs have been exceeded
400 Bad Request Unknown "operation" type
400 Bad Request Cannot delete all NPIs from List
400 Bad Request Smart lists cannot be updated or deleted using the NPI List API.
400 Bad Request PulsePoint provided lists cannot be updated or deleted using the NPI List API
400 Bad Request List is archived and needs to be un-archived in order to be updated.
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 --request PATCH 'https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/33388' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
  "operation": "add",
  "npis": ["3137933122", "3134730123"]
}'

PYTHON

import requests
import json

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

payload = json.dumps({
  "operation": "add",
  "npis": [
    "3137933122",
    "3134730123"
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <token>'
}

response = requests.request("PATCH", url, headers=headers, data=payload)

print(response.text)

JAVA

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"operation\": \"add\",\n  \"npis\": [\"3137933122\", \"3134730123\"]\n}");
Request request = new Request.Builder()
  .url("https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/33388")
  .method("PATCH", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer <token>")
  .build();
Response response = client.newCall(request).execute();

JAVASCRIPT

const myHeaders = new Headers()
myHeaders.append('Content-Type', 'application/json')
myHeaders.append('Authorization', 'Bearer <token>')

const raw = JSON.stringify({
  operation: 'add',
  npis: ['3137933122', '3134730123'],
})

const requestOptions = {
  method: 'PATCH',
  headers: myHeaders,
  body: raw,
  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))

6. Delete NPIs from a list

This endpoint allows clients to delete NPIs from one list.

PATCH

ENDPOINT

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

SAMPLE REQUEST

{
  "operation": "remove",
  "npis": ["3137933122", "3134730123"]
}

If successful in your request the response will return a 200. If your request fails it will return one of the following errors:

Error Code Description
400 Bad Request Invalid property name for post operation
400 Bad Request Invalid value(s) for "applications"
400 Bad Request NPI ID can not be empty
400 Bad Request Invalid NPI ID
400 Bad Request NPI ID can not exceed 10 characters
400 Bad Request "advertisers" is required
400 Bad Request 1Mn NPIs have been exceeded
400 Bad Request Unknown "operation" type
400 Bad Request Cannot delete all NPIs from List
400 Bad Request Smart lists cannot be updated or deleted using the NPI List API.
400 Bad Request PulsePoint provided lists cannot be updated or deleted using the NPI List API
400 Bad Request List is archived and needs to be un-archived in order to be updated.
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 --request PATCH 'https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/33388' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
  "operation": "remove",
  "npis": ["3137933122", "3134730123"]
}'

PYTHON

import requests
import json

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

payload = json.dumps({
  "operation": "remove",
  "npis": [
    "3137933122",
    "3134730123"
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <token>'
}

response = requests.request("PATCH", url, headers=headers, data=payload)

print(response.text)

JAVA

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"operation\": \"remove\",\n  \"npis\": [\"3137933122\", \"3134730123\"]\n}");
Request request = new Request.Builder()
  .url("https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/33388")
  .method("PATCH", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer <token>")
  .build();
Response response = client.newCall(request).execute();

JAVASCRIPT

const myHeaders = new Headers()
myHeaders.append('Content-Type', 'application/json')
myHeaders.append('Authorization', 'Bearer <token>')

const raw = JSON.stringify({
  operation: 'remove',
  npis: ['3137933122', '3134730123'],
})

const requestOptions = {
  method: 'PATCH',
  headers: myHeaders,
  body: raw,
  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))

NPI API ENDPOINTS - NPI LISTS WITH ATTRIBUTES

An NPI list with attributes is an NPI list that appends a client's metadata to their list of NPIs. This endpoint allows users to create an NPI list with attributes, replace an NPI list with attributes and view an NPI list with attributes.

Definitions:

  • Attribute = column headers
  • AttributeValues = value for corresponding attribute header per NPI
  • Name = NPI list name (upon creation)
  • NpiColumnIndex = which column contains NPIs (Starts with first column = 0)
  • NPIListId = the Pulsepoint numeric identifier for the NPI list.

1. Create NPI list with attributes

Create new NPI lists with client’s own attributes.

POST

ENDPOINT

/v1/npi/npi-list/account/{accountId}/attributes

SAMPLE REQUEST

{
  "attributeValues": [
    ["1639137706", "yes", "NPI Targeted Banners", "PulsePoint Inc.", "123456"]
  ],
  "attributes": ["NPI_ID", "Active", "CampaignName", "CompanyName", "CustomID"],
  "name": "NPI_with_Attr",
  "npiColumnIndex": 0,
  "applications": ['LIFE'],
  "advertisers": ["Demo"]
}

PLEASE_NOTE

The applications field accepts either [“LIFE”], [“SIGNAL”] or [‘SOCIAL”]. These are products used within Pulsepoint.

  • LIFE: Pulsepoints Buying platform
  • SIGNAL: HCP365
  • SOCIAL: ...

If successful in your request the response will return a 200. If your request fails it will return one of the following errors:

Error Code Description
400 Bad Request Invalid property name for post operation
400 Bad Request Invalid value(s) for "applications"
400 Bad Request NPI ID can not be empty
400 Bad Request Invalid NPI ID
400 Bad Request NPI ID can not exceed 10 characters
400 Bad Request "advertisers" is required
400 Bad Request 1Mn NPIs have been exceeded
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 --globoff '{{base_url}}/123456/attributes' \
--header 'Content-Type: application/json' \
--header 'Authorization', 'Bearer <token>' \
--data '{
  "attributeValues": [
    ["1639137706", "yes", "NPI Targeted Banners", "PulsePoint Inc.", "123456"]
  ],
  "attributes": ["NPI_ID", "Active", "CampaignName", "CompanyName", "CustomID"],
  "npiColumnIndex": 0
}'

PYTHON

import requests
import json

url = "{{base_url}}/123456/attributes"

payload = json.dumps({
  "attributeValues": [
    [
      "1639137706",
      "yes",
      "NPI Targeted Banners",
      "PulsePoint Inc.",
      "123456"
    ]
  ],
  "attributes": [
    "NPI_ID",
    "Active",
    "CampaignName",
    "CompanyName",
    "CustomID"
  ],
  "npiColumnIndex": 0
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

JAVA

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"attributeValues\": [\n    [\"1639137706\", \"yes\", \"NPI Targeted Banners\", \"PulsePoint Inc.\", \"123456\"]\n  ],\n  \"attributes\": [\"NPI_ID\", \"Active\", \"CampaignName\", \"CompanyName\", \"CustomID\"],\n  \"npiColumnIndex\": 0\n}");
Request request = new Request.Builder()
  .url("{{base_url}}/123456/attributes")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer <token>")
  .build();
Response response = client.newCall(request).execute();

JAVASCRIPT

const myHeaders = new Headers()
myHeaders.append('Content-Type', 'application/json')
myHeaders.append('Authorization', 'Bearer <token>')

const raw = JSON.stringify({
  attributeValues: [
    ['1639137706', 'yes', 'NPI Targeted Banners', 'PulsePoint Inc.', '123456'],
  ],
  attributes: ['NPI_ID', 'Active', 'CampaignName', 'CompanyName', 'CustomID'],
  npiColumnIndex: 0,
})

const requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow',
}

fetch('{{base_url}}/123456/attributes', requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.error(error))

2. Replace NPI list with attributes

Replace the entire NPI list with the new set of NPIs with corresponding attributes.

PUT

ENDPOINT

/v1/npi/npi-list/{NPIListId}/attributes

SAMPLE REQUEST

{
  "attributeValues": [
    ["1639137706", "yes", "NPI Targeted Banners", "PulsePoint Inc.", "123456"]
  ],
  "attributes": ["NPI_ID", "Active", "CampaignName", "CompanyName", "CustomID"],
  "npiColumnIndex": 0
}

If successful in your request the response will return a 200. If your request fails it will return one of the following errors:

Error Code Description
400 Bad Request Invalid property name for post operation
400 Bad Request Invalid value(s) for "applications"
400 Bad Request NPI ID can not be empty
400 Bad Request Invalid NPI ID
400 Bad Request NPI ID can not exceed 10 characters
400 Bad Request "advertisers" is required
400 Bad Request 1Mn NPIs have been exceeded
400 Bad Request Cannot change application property during update
400 Bad Request List is archived and needs to be un-archived in order to be updated.
REQUEST EXAMPLES
Below are a list of code examples for CURL, Python, Java and JavaScript

CURL

curl --location --globoff --request PUT '{{base_url}}/123456/attributes' \
--header 'Content-Type: application/json' \
--header 'Authorization', 'Bearer <token>' \
--data '{
  "attributeValues": [
    ["1639137706", "yes", "NPI Targeted Banners", "PulsePoint Inc.", "123456"]
  ],
  "attributes": ["NPI_ID", "Active", "CampaignName", "CompanyName", "CustomID"],
  "npiColumnIndex": 0
}'

PYTHON

import requests
import json

url = "{{base_url}}/123456/attributes"

payload = json.dumps({
  "attributeValues": [
    [
      "1639137706",
      "yes",
      "NPI Targeted Banners",
      "PulsePoint Inc.",
      "123456"
    ]
  ],
  "attributes": [
    "NPI_ID",
    "Active",
    "CampaignName",
    "CompanyName",
    "CustomID"
  ],
  "npiColumnIndex": 0
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <token>'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)

JAVA

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"attributeValues\": [\n    [\"1639137706\", \"yes\", \"NPI Targeted Banners\", \"PulsePoint Inc.\", \"123456\"]\n  ],\n  \"attributes\": [\"NPI_ID\", \"Active\", \"CampaignName\", \"CompanyName\", \"CustomID\"],\n  \"npiColumnIndex\": 0\n}");
Request request = new Request.Builder()
  .url("{{base_url}}/123456/attributes")
  .method("PUT", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer <token>")
  .build();
Response response = client.newCall(request).execute();

JAVASCRIPT

const myHeaders = new Headers()
myHeaders.append('Content-Type', 'application/json')
myHeaders.append('Authorization', 'Bearer <token>')

const raw = JSON.stringify({
  attributeValues: [
    ['1639137706', 'yes', 'NPI Targeted Banners', 'PulsePoint Inc.', '123456'],
  ],
  attributes: ['NPI_ID', 'Active', 'CampaignName', 'CompanyName', 'CustomID'],
  npiColumnIndex: 0,
})

const requestOptions = {
  method: 'PUT',
  headers: myHeaders,
  body: raw,
  redirect: 'follow',
}

fetch('{{base_url}}/123456/attributes', requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.error(error))

3. View NPI list with attributes

Show the current NPI list with corresponding attributes.

GET

ENDPOINT

/v1/npi/npi-list/{NPIListId}/attributes

SAMPLE RESPONSE

{
  "attributeValues": [
    ["1639137706", "yes", "NPI Targeted Banners", "PulsePoint Inc.", "123456"]
  ],
  "attributes": ["NPI_ID", "Active", "CampaignName", "CompanyName", "CustomID"],
  "name": "NPI_with_Attr",
  "advertisers": ["Demo"]
}

If successful in your request the response will return a 200. If your request fails it will return one of the following errors:

Error Code Description
400 Bad Request NPI provided is not a NPI Attribute List.
400 Bad Request Unknown NPI list ID
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/123456/attributes' \
--header 'Authorization: Bearer <token>'

PYTHON

import requests

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

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

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

print(response.text)

JAVA

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://lifeapi.pulsepoint.com/RestApi/v1/npi/npi-list/123456/attributes")
  .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/123456/attributes',
  requestOptions,
)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.error(error))