Sandbox development

A guide to making requests to the sandbox environment

A sandbox/demo environment is available for testing integrations via public API calls. Developers can request provisioning with full access to a demo company where to test code before actually interacting with a production environment.

Contact your account manager or account executive to request this environment and get Oauth credentials for generating tokens.

🚧

This environment is a demo and all information could be deleted at any moment.

Requirements

After provisioning you should receive the following items:

  • Oauth Id
  • Oauth Secret
  • ApiKey
  • Admin user credentials for the demo company
  • Company name Integrations - {company name}

πŸ“˜

ApiKey

Currently the main supported authentication method is via OAuth2 on behalf of a User.
ApiKeys provide total access not associated to any user. This type of credentials may not be provided as their not fully available yet.

First Steps

Head over to the sandbox environment and login with the admin user credentials provisioned. Then, on the same browser tab open https://api.demo.factorialhr.com/oauth/authorize?client_id=CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code to generate an Oauth2 code. Don't forget to replace CLIENT_ID with the Oauth Id provisioned. This will take you to a page where you authorise the Oauth2 protocol.

Take note of the code generated.
The next step is creating a user token, this can be done with a simple curl request.

curl -X POST 'https://api.demo.factorialhr.com/oauth/token' -d 'client_id=CLIENT_ID&client_secret=CLIENT_SECRET&code=CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob'

Don't forget to replace CLIENT_ID with provisioned Oauth2 Id, CLIENT_SECRET with provisioned Oauth2 secret and the generated CODE!
Finally retrieve the token from the response and you're ready to make API calls. In the next page you have code examples of how to make request with this token.

πŸ“˜

Api Call Examples

Notice the examples in the next page have the production domain. Don't forget to change them to https://api.demo.factorialhr.com

First API call

To test the token, a simple and easy request is retrieving the information of the token. To do so perform the following curl request. Don't forget to replace TOKEN.

curl https://api.demo.factorialhr.com/api/v1/me -H 'Authentication: Bearer TOKEN'

Conclusion

All endpoints available in this docs are also available in the sandbox environment. Don't forget to check the domain in your requests.
Useful links have been listed below.


Did this page help you?