Skip to content
Snippets Groups Projects
Commit 27b8b75b authored by Vincent Texier's avatar Vincent Texier
Browse files

Add mutation example (write query)

parent cb48958a
Branches
No related tags found
1 merge request!3WIP: RFC 3 : GraphQL API for Duniter Client
...@@ -267,11 +267,20 @@ You can use these to paginate your list and avoid a "timebomb" request. ...@@ -267,11 +267,20 @@ You can use these to paginate your list and avoid a "timebomb" request.
leading to slower and bigger responses that can, at the end, crash the server.* leading to slower and bigger responses that can, at the end, crash the server.*
```javascript ```javascript
# Query with variables and default values
query getIdentities($offset: Int = 0, $limit: Int = 1000) { query getIdentities($offset: Int = 0, $limit: Int = 1000) {
Identities { Identities {
uid uid
} }
} }
# Variables values for the request
{
"offset": 1000,
"limit": 1000
}
``` ```
List response: List response:
...@@ -292,4 +301,30 @@ List response: ...@@ -292,4 +301,30 @@ List response:
**Send an Identity Document:** **Send an Identity Document:**
GraphQL use another type of query to modifiy server's data. It is called "mutation".
As arguments, you must use "input objects" defined in the schema on the server.
```javascript
# Send a write mutation
mutation sendIdentityDocument($identityRaw: InputIdentityRaw!) {
Identity
}
# Variables
{
"identityRaw": "Version: 10\n
Type: Identity\n
Currency: CURRENCY_NAME\n
Issuer: PUBLIC_KEY\n
UniqueID: USER_ID\n
Timestamp: BLOCK_UID\n
SIGNATURE"
}
```
## Duniter Server module
The Duniter module handling the GraphQL API on the server.
TODO TODO
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment