API Gateway and joining APIs

1,016 views
Skip to first unread message

Erol Merdanović

unread,
Sep 26, 2015, 3:41:51 PM9/26/15
to API Craft
Hello

I have been testing few open source API gateways (https://groups.google.com/forum/#!searchin/api-craft/tyk/api-craft/hrCMH-HeXY8/JWjz-trzyLIJ) and they work great.

But after reading few blogs posts (mostly from Netflix) about their ability to return different responses based on the device, I just can't seem to find this feature. I'm mostly interested in ability to merge multiple sub API responses into one larger (simple JSON merge) based on the device.

Has anyone successfully done this with a API gateway? Can someone please recommend an API gateway with this ability?

Richard Simon

unread,
Sep 30, 2015, 11:33:18 AM9/30/15
to API Craft
They have custom endpoints for each device that then interact with the API.  This is generally called an experience api and focuses on the needs of a specific device/platform, and works with the resource based api's to manage better structures.  If you had custom end points for each device, or custom experience api's, you can then tailor the payload and aggregate multiple resources into the larger payload.

Erol Merdanović

unread,
Oct 5, 2015, 2:18:00 AM10/5/15
to API Craft
Richard, thank you for the reply.

Yes, this is my goal but I'm not able to find a good API gateway that can do this out-of-the-box.

Martin Buhr

unread,
Oct 5, 2015, 10:59:08 AM10/5/15
to API Craft
Hi Erol,

I doubt you'll find this kind of thing out of the box, as it's quite a specific use case that will differ heavily from API to API, however if you are looking to create custom device-specific aggregate endpoints, https://tyk.io has a feature called virtual endpoints that lets you create programatic aggregate endpoints using JS snippets.

The JS snippets could do anything, but they are specifically useful for custom aggregates like this. 

Full Disclosure: I'm the founder and lead dev of Tyk, so I'm a bit biased ;-)

The reason we added the virtual endpoints feature was specifically for users to be able to create custom, sane APIs from a bunch of microservices, e.g: You have four services: product detail, product reviews, stock levels and country-based pricing data by some kind of product SKU. A cleint would need to make four separate requests (or one batch request, if supported), to get all that data and present it in a single view to a mobile user. Instead, you create a virtual endpoint, that makes the batch request for the user, and either replies with all the data, or reformats it into a device-specific data structure and returns that, via a cache.

I think the trickiest thing to do would be to add some kind of device detection into the mix. 

Cheers,
Martin




Erol Merdanović

unread,
Oct 6, 2015, 3:07:57 AM10/6/15
to API Craft
Hi Martin

Thank you for the reply. I tested tyk but honestly I wasn't impressed. But I will give it another go.

This is the exactly the thing I'm looking for. May I ask why JS is used?

Regarding the detection of the devices. I think the best way would be to have additional field when creating users (so I can say that user is coming from X device). The response would be generated based on that field. Or to assign users to a group (mobile, slow-mobile, ...)

Martin Buhr

unread,
Oct 6, 2015, 10:53:23 AM10/6/15
to api-...@googlegroups.com
Hi Erol,

Thanks for the feedback :-/ May I ask what the issues were that left you unimpressed? Feedback is always valuable for us in order to improve things.

We chose JS because it's ubiquitous, we toyed with using Lua but felt that it wouldn't give us a safe sandbox, the JS VM we use is completely isolated from anything else and is set up on a per-API basis, so it's completely isolated in scope to it's owners, there's also no external dependencies.

If you are doing device detection using a pre-set field, then with Tyk that's really simple - all generated tokens in tyk can have a meta-data k/v set attached, this can easily carry your device config and be used in the virtual endpoint.

Cheers,
Martin 

--
You received this message because you are subscribed to a topic in the Google Groups "API Craft" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/api-craft/2g8qFWzw3oM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/d/optout.

MattM

unread,
Oct 6, 2015, 12:12:50 PM10/6/15
to API Craft
Hi Erol,

We have this capability (client/user-agent detection) in a graphical configuration, but our gateway is not open source.  I understand if that's a constraint, but please let me know if it isn't.

Thanks, m@

sinzone

unread,
Oct 14, 2015, 1:41:51 AM10/14/15
to API Craft
Erol,

https://github.com/Mashape/kong will release open-source a plugin for device detection soon.

Erol Merdanović

unread,
Oct 14, 2015, 2:18:55 PM10/14/15
to API Craft
Great. Last time I talked with their support, they suggested to write my own plugin.

Nirmalkumar Seshachalam

unread,
May 4, 2018, 11:51:04 PM5/4/18
to API Craft
Dear Erol,

I too have this requirements

1) merge responses from webservices &
2) device detection.

It would be grateful if you let me know
1) which platform is matching best &
2) what additional custom dev need to be done

Thanks a million in advance!!!
Nirmal
Reply all
Reply to author
Forward
0 new messages