How to query your own data

1. Request a one-time-password

To get an authentication token, you'll need to log into Dateforce the same way you do in the app but by making manual requests. Make a request to get a one-time-password code. See the curl and PowerShell examples below.

Bash

      
curl -X POST \
-H "Content-Type: application/json" \
-d '{
  "phoneNum": "PHONE_NUMBER",
  "countryCode": "COUNTRY_CODE"
}' \
https://auth.dateforce.app/api/v1/phone
       
    

PowerShell

      
$body = @{
  phoneNum = "PHONE_NUMBER"
  countryCode = "COUNTRY_CODE"
} | ConvertTo-Json

Invoke-RestMethod -Uri 'https://auth.dateforce.app/api/v1/phone' -Method Post -Body $body -ContentType 'application/json'
      
    

Note that your country code should start with a "+" sign. For example, the United States is "+1". The phone number should have no spaces or dashes. For example, a US phone number would be "1234567890"

2. Send the one-time-password

With the one-time-password code, made a similar request to the code endpoint. The code should be a string of numbers and no other characters. For example: "123456"

Bash

      
curl -X POST \
-H "Content-Type: application/json" \
-d '{
  "phoneNum": "PHONE_NUMBER",
  "countryCode": "COUNTRY_CODE",
  "otpCode": "OTP_CODE"
}' \
https://auth.dateforce.app/api/v1/code
       
    

PowerShell

      
$body = @{
  phoneNum = "PHONE_NUMBER"
  countryCode = "COUNTRY_CODE"
  otpCode = "OTP_CODE"
} | ConvertTo-Json

Invoke-RestMethod -Uri 'https://auth.dateforce.app/api/v1/code' -Method Post -Body $body -ContentType 'application/json'
      
    

You should get a response that looks something like this. Note if you're using PowerShell, the token is long so it may be cutoff with default PowerShell settings.

      
{
  "token": "long-string-of-characters"
}
      
    

Treat these authentication tokens like a password and never share them with anyone! No one from Dateforce will ever ask you for this code. Note that these tokens will expire in one year.

3. Add token to the GraphQL Endpoint

Navigate to graphql.dateforce.app. In the header input on the bottom left, add the token in the following format.

      
{
  "Authorization": "Bearer YOUR_TOKEN_HERE"
}
      
    

Send a test query

To confirm you authentication token is working, send this test query. It should return your user information.

      
query ExampleQuery {
  user {
    phone
    email
  }
}
      
    

4. Get the GraphQL Schema

Click the "Refetch GraphQL Schema" on the bottom left. This button looks looks like two arrows that form a circle. This will give you all the information on what data you can query.

5. Query your data

Click on the documentation explorer icon on the upper left. This should now be populated. You can form your queries based on the GraphQL Schema. Typing in the text editor will now provide suggestions based on the schema.