API and Authentication

What is the difference between databaseId and Id?

The Id is the base64-encoded version of the databaseId with the ObjectType.

In other words, Id = ObjectType + : + databaseId

For example, if the databaseId for a recipe is b78a8f0d-4c89-4df1-bc73-42e2175e2737 then its iD would be UmVjaXBlOmI3OGE4ZjBkLTRjODktNGRmMS1iYzczLTQyZTIxNzVlMjczNw==

In Python, this would be done as follows:


When should I use a DatabaseID?

Use the databaseID to execute some of the queries and mutations. The databaseID parameter is the base64-encoded version of the ID of an element that can be either of a user or a recipe.

For that reason, use thedatabaseId to send it as a sg-user parameter in the header.

To get the databaseID, execute the users query and to replace in the mentioned variable as follows:

  "Authorization": "Token replace_user_token",
  "sg-user": "c975dac5-4d23-b348-cb30-ec50b33c4f91"

Include the databaseID in the sg-user for all the queries that are executed on behalf of a user. For example:

Using it in the header:

  • If you need to get the list of all users created with a specific token, it is only required to send the token parameter because we don't require to get the information of a specific user.

  • If you need to generate a meal plan, it is required to send the databaseID in the header since it will be generated for a specific user.

Use it in a mutation:

  • If you need to update your own recipe, you will need to pass the databaseID as a parameter on the updateOwnRecipe mutation.

  • If you need to delete/remove your own Recipe.

When should I use an ID?

Use the ID when you The ID is the base64-encoded version of the databaseId. Use this ID to send it as a parameter within a query or a mutation.

Some common examples:

  • To retrieve the information of a specific recipe

  • To retrieve the details of a particular program based on its ID.

  • To update the status of a "day" on a journey

What is the difference between JWT and API Token Authentications?

The JWT authentication is intended to be used on the client-side while the API token authentication must be only used on the server-side.

For more information, check the Authentication documentation.

When I should use the Suggestic-Partner token?

Partners/clients which have an isolated database will need to authenticate by using a different HTTP header named Suggestic-Partner.

For more information, check the authentication documentation.

Last updated