We recommend using the free tool Postman for accessing the City API (CNAPI, pronounced 'canopy'). The tool can be downloaded at https://www.getpostman.com/downloads/.


Once you have Postman installed, you'll have a blank workspace:



You'll need to import the Exaptive CNAPI Postman collection and two Postman environments (one for admin access and one for lower-level calls). Click on the links below to download the files, then use the Postman 'Import' function to add them to your Postman workspace. You can import all 3 files at once.


CNAPI Postman Collection

Blank CNAPI Environment

Blank CNAPI Admin Environment


After the files have been imported, you should have the CNAPI collection in your workspace menu on the left, and the two blank environment files in the environment dropdown list in the upper right:



Now you'll need to configure your environment files to point to your city, and to contain the correct authentication credentials. Select the CNAPI Admin environment from the dropdown in the upper right, and click on the eye icon to inspect the environment variables. Edit the current value fields to set the api field to the top-level url for your city, and set the email and password fields with the credentials for your City admin: 



Switch to the CNAPI non-admin environment and set the api, city-email, and city-password fields there too. Note that the api field in this environment is versioned so it contains /api/v1 after the top-level url:



Now test out each environment configuration to make sure you can successfully authenticate. There is an 'Auth' folder at the top-level of the Postman CNAPI collection. Select the 'Authenticate' method and click the 'Send' button. You should get a JSON return payload back with a 'success' status:



At the bottom of the Postman collection is an 'Admin' folder. To use these functions don't forget to switch your environment over to the Admin environment. After you make that switch, call the GetToken method in the Admin/Authenticate folder. You should see a similar success JSON payload returned:



If you get an error message like shown in the image below, make sure that you're using the correct environment for the call you're attempting. All of the functions contained within the bottom 'Admin' folder should be used with the Admin environment. All of the functions above the Admin folder should be used with the non-admin environment.



Once you are authenticated, you can start using the other methods of the API. If you try to make an API call without authenticating first, you will receive a "Failed to Authorize" error in the returned JSON payload. The City API uses Javascript Web Tokens (JWTs) to secure api calls. These tokens will expire after an hour so if you find that your API calls suddenly starts giving you an authorization error, go back to the appropriate authentication method and re-authenticate to receive a new token.