Expand my Community achievements bar.

Configuring restapi into the api mesh

Avatar

Level 2

I have a requirement to configure the restapi with an API mesh, as we hit the rest api through Postman, populating the required parameter and headers provides the JSON schema result.

restapi- https://sandbox-api.ornament.health/public/file-api/v1.0/fileset

parameter- pid (Ex: 1018fee1-d1...........................)

header-Authorization: Bearer eyJhbGciOiJBMjU2S1ciLCJlbmMi.....................

 

API mesh gives us a graphql endpoint and if I add this source(restapi) to API mesh then how will I fetch the same response from that graphql endpoint?

We need some query to fetch the data, what is the process and how can I achieve this?

https://developer.adobe.com/graphql-mesh-gateway/mesh/advanced/extend/resolvers/

following this document.

 

2 Replies

Avatar

Community Advisor

Hi @ShubhamAg2 To fetch the response from the REST API via API Mesh, after adding the REST API as a source, you need to make sure to define the GraphQL schema and resolvers that map your GraphQL queries to the REST API requests. This way, you can query the data using GraphQL and get the same result as the REST API.


1- First add the REST API as a source in API Mesh following the steps outlined in the documentation you provided.
2- You need to define the GraphQL schema for the API.

3- Define the resolver in the API Mesh configuration. The resolver will handle fetching data from the REST API when the GraphQL query is executed.

4- Once the GraphQL schema and resolvers are set up, try query the GraphQL endpoint generated by API Mesh.

 

ONce done, Hit the GraphQL endpoint with the query in Postman.

 

Hope this helps.

Thanks, @Pradeep_Kumar_Srivastav 

Can you provide any documentation on how I can configure the resolver, schema, and API header credentials for the mesh.json file?

How will I provide API parameters, and headers needed to call API via Postman in mesh.json and how will I define and configure the resolver, and schema to the mesh.json file?