This article is DEPRECATED, you can find the correct article here.
What is the GraphQL?
The GraphQL is an endpoint to programmatically get data from the eSuite environment with an API call.
How do I know what data I can get or submit via the GraphQL?
The GraphQL has built in documentation. When we provide you with the correct URL to connect to the GraphQL, we will also provide you with the URL to a website where you can find the documentation. In this documentation you can find the endpoints and parameters you'll have to provide and the results you can expect.
How do I connect to the GraphQL?
We'll provide you with two URLs.
One to start the authentication flow and one to connect to the GraphQL. Authentication is provided via the OAuth 2.0 Username-Password Flow. See https://www.oauth.com/oauth2-servers/access-tokens/password-grant/ for more information about the protocol.
Example
Send a "POST" call for an authentication request to a URL that epowerhr will provide. This call must include the below parameters in the BODY as "form-data" or "x-www-form-urlencoded".
POST --url provided by epowerhr-- client_id=api.epowerhr& grant_type=password& username=--username--&
password=--password--&
scope=openid api.epowerhr
The response includes an access token. The expires_in and expires_at tell you when the token becomes invalid. At that point, you'll have to request a new access token.
RESPONSE /connect/token
{
token: {
access_token: --access token to use with GraphQL request--,
expires_in: 3600,
token_type: 'Bearer',
scope: 'api.epowerhr openid',
expires_at: DATE
}
}
- Once you have a valid access token. You can use that token to do requests to the GraphQL. The URL is different from the authentication URL and this will also be provided by epowerhr.
In a new "POST" call you must add the access token in the "Authorization" as a "Bearer". In the BODY you can send your GraphQL query. More information on GraphQL and queries can be found here.
POST --URL provided by epowerhr--
HEADERS: 'Authorization': 'Bearer --access_token--'
BODY: --GraphQL request--