Headers usually carry important information on meta-data associated with an API request and response. It’s true that headers are considered an optional field in our app creation module and they vary depending on which app you are working on. Nonetheless, they are being used in several endpoints for almost all the apps currently set up on the Integry platform. Details about headers associated with endpoints have been documented here.
Base URL headers
Apart from specific headers that you add to endpoints, you may occasionally want to define global level headers for an app. This way, headers can be associated with the API base URL that you define on the basic info page of an app. The base URL is used to send all the API calls for an app. More details about base URL can be found here.
This gives you a means to create default headers that can be used with any endpoint that uses a specific base URL. Benefiting from this, you can add a partner key or a service authentication token to every call that your app makes for performing activities.
This also saves you the effort of separately defining those headers for every endpoint in an app. An endpoint that uses a base URL with headers will automatically use those headers in the calls, unless you manually specify different headers for that endpoint. Local header definitions will always override the global header definitions.
As an example for this, let’s say you are setting up your app, Basecamp, on Integry. From basecamp API documentation, we can see that all URLs for making API calls start with:
So this will probably be one of your base URLs for the app. When you add this to the Base URL section of your app’s basic info, you will also see the option of adding headers to it as indicated below.
Clicking on the Add Headers button will bring up the standard fields that are used to configure all your headers. This is also shown below.
You can add any headers here according to your requirements and they will be stored with this base URL. For the current example, you can add the following headers and they will look like as shown below.
This base URL and its associated headers can be used in all the relevant endpoints, like those for authorization, etc. Your headers can vary from app to app, this example is specific to Basecamp.