Rest service Integration to Adobe MESH API | Community
Skip to main content
HeenaMadan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
February 20, 2024
Solved

Rest service Integration to Adobe MESH API

  • February 20, 2024
  • 2 replies
  • 1346 views

Hi,

 

Anybody using Rest API in Adobe mesh?

 

I have requirement to create mesh for third party rest api and graphql response. As third party REST api is kind of search service which needs query params to fetch results.

 

Below is my sample json response when i do search

endpoint: https://<searchendpoint>?key=abc&query=<phrase>&pageSize=<pagesize>

Sample response:

 

 

"{\"numFound\":6,\"query\":\"test\",\"start\":0,\"pageSize\":1,\"page\":0,\"results\":[{\"url\":\"url.html",\"path\":\"url",\"title\":\"titlecvalue",\"category\":\"products\",\"productCategory\":\"Electric Strikes\",\"productFamily\":\"family\",\"image\":\"/content/dam/xyz.jpg"}]}"

 

 

Mesh config:

{ "meshConfig": { "files": [ { "path": "./demoResponse.json", "content": "{\"numFound\":6,\"query\":\"1500\",\"start\":0,\"pageSize\":1,\"page\":0,\"results\":[{\"url\":\"https://www.abc.com/en/products/abc\",\"path\":\"path\",\"title\":\"title\",\"category\":\"products\",\"description\":\"descp",\"productCategory\":\"categoryy\",\"productFamily\":\"family",\"image\":\"/content/dam/xyz.jpg\"}]}" } ], "sources": [ { "name": "myapi", "handler": { "JsonSchema": { "baseUrl": "<endpoint>", "operations": [ { "path": "/search?sub_key={args.sub_key}&query={args.query}&c={args.c}&pageSize={args.pageSize}", "argTypeMap": { "sub_key": { "type": "string" }, "query": { "type": "string" },"c": { "type": "string" },"pageSize": { "type": "number" } }, "responseSample": "./demoResponse.json", "type": "Query", "field": "results", "method": "GET" } ] } } } ] } }

I am following https://developer.adobe.com/graphql-mesh-gateway/reference/handlers/json-schema/ 

in this example sample json file is not available so i am not able to understand.

 

Can anybody help me here?

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by HeenaMadan

No, as it is not supported in mesh. But as wrokaround we can pass value using context headers. 

For eg: {context.headers['search-term']}

Thanks

2 replies

arunpatidar
Community Advisor
Community Advisor
February 20, 2024
HeenaMadan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
February 20, 2024

Hi @arunpatidar 

yes I am referring  same mesh doc.Normal graphql integartion is working but i didn't find Integration with rest endpoint. 

kautuk_sahni
Community Manager
Community Manager
March 7, 2024

@heenamadan Were you able to find a solution to this problem? If so, please share this would the community. 

Kautuk Sahni
HeenaMadan
Community Advisor and Adobe Champion
HeenaMadanCommunity Advisor and Adobe ChampionAuthorAccepted solution
Community Advisor and Adobe Champion
April 9, 2024

No, as it is not supported in mesh. But as wrokaround we can pass value using context headers. 

For eg: {context.headers['search-term']}

Thanks