Customizable ExecutionResult, or how to get other API response parts
See original GitHub issueCase:
The GraphQL API that I need to make requests to, responds with some other useful information, except of data
block:
{
"data": {...},
"extensions": {
"pageInfo": {
"limitPage": 200,
"totalCount": 23306516,
"hasNextPage": true,
"lastId": 41922710
}
}
}
But, as gql transport composes ExecutionResult
from data
and errors
blocks only, I’m not able to get and use the extensions
part in my code.
I was hoping to use hasNextPage
and lastId
values to iterate through pages of data, to load all the data to database.
Question:
Is there any way to get extensions
part of response, along with data
and errors
, using gql?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
3 Ways to Make Your API Responses Flexible - Zapier
Most APIs deliver their responses the exact same way to every client. That's by design; developers need to know what to expect.
Read more >Modifying REST API responses | Contentful
This guide illustrates how to use the `select` operator to modify the API payload to include only the relevant data.
Read more >Customize REST API Responses - OutSystems documentation
Open the OnResponse callback action that's now available under the REST API. Design the logic to customize the information of the response.
Read more >How to return a custom error object and status code from API ...
Go ahead and play around with it some first. I'll dissect each part later in the article. The Lambda function. Create a Lambda...
Read more >Understanding And Using REST APIs - Smashing Magazine
Everything you need to know about REST APIs, from start to finish. How and why to use REST APIs, how to deal with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for your answers! I see that the extensions field was added to ExecutionResult in graphql-core. It seems that this change is not in release version yet. I just tried to fork repo and add extensions field for transports, but the ExecutionResult imported from graphql doesn’t have this field either.
Finally I choose to add a
get_execution_result
argument toexecute
and subscribemethods
.See PR #257