myUser

GraphQL Query for User Details

Query Structure

query myUser {
  myUser {
    id
    identifier
    email
    first_name
    last_name
    admin
    organization {
      id
      identifier
      admin
      restricted
      enabled
    }
  }
}

JavaScript Code Example

const axios = require('axios');

let token = 'YOUR TOKEN';

let data = JSON.stringify({
  query: `query myUser {
    myUser {
        id
        identifier
        email
        first_name
        last_name
        admin
        organization {
            id
            identifier
            admin
            restricted
            enabled
        }
    }
}`,
  variables: {}
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://sandbox.external.routefusion.com/graphql',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

Sample Response

{
  "data": {
    "myUser": {
      "id": "user-id",
      "identifier": "user@example.com",
      "email": "user@example.com",
      "first_name": "FirstName",
      "last_name": "LastName",
      "admin": true,
      "organization": {
        "id": "organization-id",
        "identifier": "Organization Name",
        "admin": false,
        "restricted": null,
        "enabled": true
      }
    }
  }
}