Here we have a working Python class that performs each task of the API.
To get started clone this repo
git clone https://github.com/mrpbennett/npi-api-demo.git
If you haven't already please install pipenv
pip install --user pipenv
OR
brew install pipenv
If you're using Homebrew
Once the repo has been cloned, from the command line enter the root directory and run the following:
pipenv install
This will install all the dependencies. Next, you will need to create a
config.toml
file in the root directory of this project. The file should have
the following layout: (please replace xxx
with your details, your account
manager will need to provide you with the pp_auth info.)
[pp_auth]
client_id = 'xxx'
client_secret = 'xxx'
url = 'https://lifeapi.pulsepoint.com/RestApi/oauth/token'
[user]
username = "xxx"
password = "xxx"
account = "xxx"
GET
: 1 request per 1 secondPUT
,POST
,PATCH
,DELETE
: 10 requests per 60 seconds
Now you're ready to test the API. Head over to main.py
where you're able to
call each one of the endpoints via the NPIListAPIClass
in npi_api_class.py
.
To do this please follow the instructions within the comments. You will also
need to choose / create a list to test with. The ID in the code 11105
will
need to be changed
When you're ready to test the endpoints, you will need to change the choice
variable to the relevant number depending on which endpoint you wish to test. The choices are as follows:
- Get a single NPI list
- Get all NPI lists from an account
- Create an NPI list
- Replace NPIs within a list
- Add NPIs to a list
- Remove NPIs from a list
Once this is changed you will need to create an environment by running the following in the terminal:
pipenv shell
Once an environment has been created we can then run the program with our choice selected.
pipenv run python main.py