Managing an existing API with APISpark allows API developers or owners to easily add a layer of authentication, access control, rate limitation, IP filtering, response caching, analytics, on top of their API, without having to implement those aspects on their own.
For that purpose, a proxy agent is needed, that will serve as an intermediary between the API consumers and the managed API. API consumers will actually issue calls to that proxy agent, that will get input from APISpark for the management features and parameters, and forward to your API the actual calls.
Until recently, developers had to download and install in their infrastructure and ask APISpark to configure this agent for their API. An advantage of this approach is that the agent can be as close as possible to your API to not incur unneeded additional latency, but for quickly trying APISpark’s management features and when latency is not a problem, this isn’t very practical to have to setup the agent on your infrastructure.
So the good news, as the title of this post hinted at, is that APISpark introduced a hosted agent, that runs on APISpark’s infrastructure, without having to do anything on your side but configuring it to point at your API!
As most geeks are, I’m sure you’re fans of Star Wars like I am, eagerly waiting for the next episode to be released later this year. In the rest of this post, I’ll guide you through setting up an API connector to the awesome Star Wars API with its associated hosted agent. Let’s get started!
First of all, let’s create a new Web API of type “connector” — the hosted agent option is selected by default:
Once your API is created, head over to the Settings tab, in the Connector section in the left panel, and click on the agent details, where you’ll be able to define the target endpoint of the API you want to manage (without trailing slash in the URL):
Then, just click deploy to deploy your API connector with the hosted agent!
And voila, here’s our nice syntax highlighted JSON output of our APISpark managed Star Wars API!
As you can see, it is pretty easy and straightforward to start managing your APIs, thanks to the hosted proxy agent provided by the platform. But as I said earlier, once latency matters, if your API is further away geographically from the datacenter where APISpark lives, it may be better to host the agent as close to your API as possible, but still leverage APISpark’s management features. Also, you can easily switch back and forth between the two modes, hosted and standalone, if you need to change mode.