Pages

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from this space and version 8.3

To get started with the Graniitti API:

  1. Set up your Frosmo user account.
  2. Get your personal access token for authenticating with the Graniitti API.
  3. Get the base URL for Graniitti API requests.
  4. Test your access to the Frosmo back end.

Setting up your Frosmo user account

All requests to the Graniitti API must be authenticated with an access token. You get your personal access token through your Frosmo user account, so you need to first set up the account. For more information, see Creating visitor journeys.

Getting your personal access token

To get your personal access token:

...

You now have your personal access token for authenticating with the Graniitti API. For more information about the token, see AuthenticationGraniitti API authentication.

Warning

Do not make Graniitti API requests in client-side code that is accessible to parties you do not trust, as this will expose your token to them. Use the Graniitti API only in server-side code and in client-side code that is only accessible to parties you trust.

Getting the base URL for requests

The base URL for Graniitti API requests depends on your Frosmo Platform instance and the API version you're using.

...

You now have the base URL for sending requests to the Graniitti API.

Testing your access

Now that you have your personal access token, test that it works correctly by making the following calls to the Graniitti API.

...

  1. Retrieve your own user information by sending a GET request to /users with your first name and last name as query parameters. Add your token to the request using the Authorization header, and prefix the token with "Bearer" followed by a space.

    Code Block
    languagepowershell
    themeRDark
    curl -X GET \
    --header 'Authorization: Bearer <access_token>' \
    'https://<graniitti_api_domain>/v0/users?firstname=<your_first_name>&lastname=<your_last_name>'


    Info

    The domain name in the above URL depends on your Frosmo Platform instance. To find out which domain name you need to use, see Getting startedthe base URL for requests.


  2. Create a new user by sending a POST request to /users with the user information passed as a JSON object.

    Code Block
    languagepowershell
    themeRDark
    curl -X POST \
    --header 'Authorization: Bearer <access_token>' \
    --header 'Content-Type: application/json' \
    -d '{"firstname":"User","lastname":"User","email":"user.user@company.com","password":"8sKJ0688p!"}' \
    'https://<graniitti_api_domain>/v0/users'

    Note the user ID in the response body.

  3. Retrieve the user you just created by sending a GET request to /users/<user_id>. Use the user ID from the response to the POST request.

    Code Block
    languagepowershell
    themeRDark
    curl -X GET \
    --header 'Authorization: Bearer <access_token>' \
    'https://<graniitti_api_domain>/v0/users/<user_id>'


  4. Delete the user by sending a DELETE request to /users/<user_id>. Use the user ID from the response to the POST request.

    Code Block
    languagepowershell
    themeRDark
    curl -X DELETE \
    --header 'Authorization: Bearer <access_token>' \
    'https://<graniitti_api_domain>/v0/users/<user_id>'


Now that you have a working token, learn about the basics of the Graniitti API and its RESTful features.