AnsweredAssumed Answered

How to customize response of an API by consumer ?

Question asked by APIMGTEtudes18000094 on Feb 16, 2017
Latest reply on Feb 17, 2017 by APIMGTEtudes18000094

Hi 

 

We would like customize response of an API, depending of consumer.

The customization consists of filtering or not the attributes of a response, according to the consumer (identified with his key API for example)

 

1) Example for 'bronze' consumer :

 

Request : GET  http://petstore.swagger.io/v2/pet/10

Response : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Pet> <category> <id>0</id> <name>Item 10</name> </category> <id>10</id> <name>doggie</name> <status>available</status> </Pet>

 

2) Example for 'gold' consumer :

 

Request : GET  http://petstore.swagger.io/v2/pet/10

Response : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Pet> <category> <id>0</id> <name>Item 10</name> </category> <id>10</id> <name>doggie</name> <photoUrls> <photoUrl>string</photoUrl> </photoUrls> <status>available</status> <tags> <tag> <id>0</id> <name>string</name> </tag> </tags> </Pet>

 

in sample2, the attributes <photoUrls> and <tags> are filtered

in sample2, the attributes <photoUrls> and <tags> are added in response

 

in fact,  the same request have sent but there is two differents responses : "Gold" consumer have more data about pet/10

 

I saw an equivalent in product "CA live API Creator" on pre-sale, but there is a way with API Gateway (9.x) and API Portal Developer (3.5) ?

 

Could someone please help me  ?

 

Regards

David

Outcomes