Skip to content

Instantly share code, notes, and snippets.

@Mifrill
Last active October 19, 2017 05:46
Show Gist options
  • Select an option

  • Save Mifrill/4a417a4b8a52b83143535d437a20389f to your computer and use it in GitHub Desktop.

Select an option

Save Mifrill/4a417a4b8a52b83143535d437a20389f to your computer and use it in GitHub Desktop.

CURL

curl -X POST "http://localhost:5000/api/v1/tokens" -d '{"auth": {"email": "editor", "password": "123"}}' -H "Content-Type: application/json"
-------------------------------------------------------------------------------------------
curl -H "Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0OTQ3ODQ1NzAsInN1YiI6Mn0.8QlJbibo2nosDSVnlYtcadJ8VFQFiaBzNueLQDDwCmU" http://localhost:5000/api/v1/pages
-------------------------------------------------------------------------------------------

Postman

{
  "query": "{ user_role(user_id: 2) { roles }}"
  "query": "{ user(id: 1) { email }}"
}
-------------------------------------------------------------------------------------------
{
  "query": "mutation{updatePage(slug: \"updated\", page: {slug: \"updated1\", markdown: \"new markdown\"}){ slug }}"
}
-------------------------------------------------------------------------------------------
{
  "query": "mutation{addUserRole(user_id: \"3\", user_role: {roles: \"developer\"}) { roles }}"
}
-------------------------------------------------------------------------------------------

GraphiQL

mutation {
  addPage(page: {slug: "qwe", markdown: "My graphql post"}) {
    slug
    markdown
  }
}
-------------------------------------------------------------------------------------------
mutation {
  deletePage(slug:"qwe") {
    slug
  }
}
-------------------------------------------------------------------------------------------
mutation {
  addUser(user: {email: "qwe2", password: "", password_confirmation: ""}) {
    id
    email
  }
}
-------------------------------------------------------------------------------------------
query($id: ID!){
  user(id: $id) {
    plim
  }
}
{
  "id": "2"
}
-------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment