The service will receive the Query and will orchestrate the calls among the mapped data sources (APIs, database, files and so on) that will return the queried information.Ī GraphQL service is created by defining types and fields on those types, then providing functions for each field on each type. The following types are defined by GraphQL: Query and Mutation TypesĮvery GraphQL server has a query and may or may not have a mutation type. These are very similar to other object types, but they have a special function defining an entry point of every GraphQL query. Query type as the name suggest, is used to fetch information from the mapped services and the Mutation type is used to create or modify data. We interpret this as a query to retrieve the id, name, street and number from an User. The result would be something like this: "data" : Run a Query" button. On the first time you try to run a query, DataGraph will ask you to inform a client application or a Client ID + Secret to manage your access. The same concept of external application to consume your APIs, when you configure it on the API Manager. Worked like a charm! The request was sent to the single endpoint and the result was according to I expected from my query.īut wait! What if I need to query for the street name and number for this user? How can I do that? There is only the ID of the address in my User object. Do I need to perform another request to Address API get it? The answer is NO and let's learn another feature. On the GraphQL session, when we were modeling the schema, there was a relationship between User and Address object directly. In our APIs, the relationship is made by an "foreign key" from user to address. We need to "join" the AddressAPI in order to get more detail about it for a specific user.Īnypoint DataGraph has a feature called "Enable Collaboration" that indicates that a specific Type from the schema can be used to enrich the query, providing information to another type.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |