Skip to content

Instantly share code, notes, and snippets.

@BransonGitomeh
Last active December 13, 2016 06:59
Show Gist options
  • Save BransonGitomeh/639dc26eba0c5cd5a9278298aee5d2fa to your computer and use it in GitHub Desktop.
Save BransonGitomeh/639dc26eba0c5cd5a9278298aee5d2fa to your computer and use it in GitHub Desktop.

Testing connection

To test the api and see if you are doing the right thing,

{
  query: { hello }
}```

* responce: 
```json 
{
  "data": {
    "hello": "world"
  }
}```


# Authentification
To get a special key to authorize all your requests,

* method:"POST",
* url: http://192.241.151.182:9001/graph/,
* type:x-www-form-urlencoded

 params: 
```graphql 
{
  query: `query getToken($username:String!,$password:String!){
  auth(username:$username, password:$password){
    hash,
    message,
    errors{
      key,
      message
    }
  }
}`,
variables:{
    "username":"[email protected]",
    "password":"test"
  }
}```

* responce: 
```json {
  "data": {
    "auth": {
      "hash": null,
      "message": null,
      "errors": [
        {
          "key": "username",
          "message": "Username not found"
        }
      ]
    }
  }
}```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment