Problem


To work with some endpoint, sometimes we need to pass additional information to requests such as authorization information, cache control information, API version, etc.  The web service usually takes this information from HTTP request headers.


Prerequisites

  • You have ShortPoint version 6.6.x.x or later.

Solution


ShortPoint Rest API and Web Service connection types have Custom headers function under Enable Advanced Settings section which allows you to set up all required headers.



Let's assume that you want to force caches to submit the request to the origin server for validation before releasing a cached copy. So you need to add Cache-Control header with value no-cache to HTTP request.


To do this you need to set up headers object in Custom header function in following format:

 

headers["<Header name>"] = <Header value>


For our case we get the following:

headers["Cache-Control"] = "no-cache";

return headers;



Headers object can accept as many headers as you want and all of them will be added to HTTP request.