With a REST API, you use can easily encode state into your URL and thereby share that URL with other people so they can see or receive the same data you are viewing
www.example.com/maps?state=California&city=Oakland
www.my-infrastucture.com/datacenter=01&environment=P&limit=10
If you are using a graphQL API, it typically uses POST for API calls.
How would I encode the state of my app via URL when developing with graphQL APIs?
What are GraphQL best practices for storing state in URLs?
- see "My Use Case" section below
Example Use Case
- I have an existing app already using a REST API but is in transition process of migrating to a graphQL API to give clients more flexibility about the data they want back
- With this web app using REST already, people can share URLs with other people to view specific pieces of data (for trouble shooting, whatever the case maybe)
- I am look to create bookmarkable URLs for a frontend web app think of a dashboard or page with a specific view that I want to share to my teammates etc.
Frontend UI tech stack
Adding additional info in case there are recommendations for library usages
- reactJS
react-queryfor server state (using fetch API internally)
Backend Stack
Adding additional info in case there are recommendations for library usages
- Python backend using Flask
- The API server I am currently working with is not an offical GraphQL compliant server, so its not using Apollo, express-graphql etc.
- The API server I am working with has a
/graphqlendpoint and that endpoint will eventually pass that graphQL query to another Backend service which is the actual server that implements GraphQL (for example, this graphQL service is from another team in my company)