This is the second post of a “How to” series which aims to highlight simple but yet powerful features of Streamdata.io. In my previous post I explained the different options to configure the polling frequency. Today will focus on the ability of Streamdata.io proxy to inject custom query parameters or HTTP Headers while performing the request against a target URL.
Again, If you are completely new to Streamdata.io, I invite you to read our How it works page, it is a good starting point to understand the general concepts. If you are not a streamer yet, you can easily register for a free account here to quickly get started.
Maybe the first question to answer is why would I need to inject any query params or headers from Streamdata.io proxy ?
Well, there are for sure several use cases for which it could be useful, but the first that comes to mind is the following:
Let’s say that your are an API Publisher willing to provide a “streamed” version of an existing API to your eco-system. If the target URL (the one you want to stream) is protected by a token, it would force you to either ask each developer to create their own token, which might not be the best developer experience you can provide. Another option would be to share your own token with all developers, which is something you might want to avoid for security reasons. That’s where params/header injection can help you by dynamically adding security parameters to requests before they are issued by streamdata.io proxy.
Let’s now see how to do that:
- Login to Streamdata.io Portal.
- Select your application.
- Navigate to My APIs menu entry. You will see the list of APIs proxified by Streamdata.io for selected app:
- Click Edit on the API for which you want to inject params/headers:
- Add your query params and/or headers in the corresponding sections. Don’t forget to click Save after making change.
That’s it. All requests made to this particular API through Streamdata.io will be embodied with the headers and query params that you have defined. You can specify different headers or query params for each of your API listed in Streamdata.io Portal.