Examples Using Rize's GraphQL API
Examples have been provided below to help you get started using Rize's GraphQL API.
The comprehensive schema documentation for Rize's API can be viewed from the GraphQL Playground at https://api.rize.io/api/v1/graphiql by clicking the "Show Documentation Explorer" icon in the top left.
Example Query
This is an example using the Project query in the Rize GraphQL API.
Project Query
curl -X POST https://api.rize.io/api/v1/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"query": "query Project($id: ID!) { project(id: $id) { id name } }",
"variables": {
"id": "124119"
}
}'Successful Response
{"data":{"project":{"id":"124119","name":"Your Project Name"}}}
Error Response
{"errors":[{"message":"Variable $id of type ID! was provided invalid value","locations":[{"line":1,"column":15}],"extensions":{"value":null,"problems":[{"path":[],"explanation":"Expected value to not be null"}]}}]}
Example Mutation
This is an example using the CreateProject mutation in the Rize GraphQL API.
CreateProject Mutation
curl -X POST https://api.rize.io/api/v1/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"query": "mutation CreateProject($name: String!) { createProject(input: { args: { name: $name } }) { project { id name } } }",
"variables": {
"name": "Your Project Name"
}
}'Successful Response
{"data":{"createProject":{"project":{"id":"124112319","name":"Your Project Name"}}}}
Error Response
{"data":{"createProject":null},"errors":[{"message":"You must be signed in to access mutation CreateProject","locations":[{"line":1,"column":42}],"path":["createProject"],"extensions":{"code":"AUTHENTICATION_ERROR"}}]}