Getting Started
This guide will help you to start using the Suggestic API
Last updated
This guide will help you to start using the Suggestic API
Last updated
Suggestic application uses Graphql query language and the GraphQL Playground, as a graphical, interactive, in-browser GraphQL IDE, to allow users to execute queries and mutations according to their needs. It can be also accessed through PHP and Python code as well as curl scripts.
To use Suggestic API, please follow the steps on the sections below:
Get your API access key and user ID to prepare your workspace
a. If you don't have your API keys yet, get a 30-day free trial on our website.
After completing the registration, the following information will display, in which you have 3 options to start using the Suggestic API
An email, with the Token and User Id information, will be sent:
b. Depending on your case, review if the authentication you are using fits your requirements.
2. Check the Quickstart tutorial section to start using the Graphql playground to execute queries and mutations
Suggestic provides an environment where you can run and test the API.
Name
URL
Production
https://production.suggestic.com/graphql
Use these prepared examples to start executing queries and mutations. The examples are separated into tabs as in the image below::
Copy the Token and User ID received in the email and paste them into the HTTP headers.
The order of implementation should be:
Finally,
Note: Use the User List mutation to get the user ID, it will be used later to execute queries and mutations.
Please note that every time you make a call to the API you will be doing it "on behalf" of a user.
1. Assign a program to the user recently created
a. Before getting the list of available programs, it is required to get the user id
as was mentioned before. Therefore, introduce the databaseID
field in the mutation as it is displayed below:
b. Obtain a list of all available diets and programs by using the following code:
Add the above code into the GraphQL playground. The list of all available programs is displayed:
c. Assign the user recently created to a program
Note: Since a specific user will be added to a program list, the User Id
is required to be added in the HTTP headers as sg-user
From the response obtained in the list of programs, copy the program id
to be assigned to the user.
For example, the following id
will be used:
UHJvZ3JhbTowMWJiZDU0MS05MzliLTRiODUtOGQ5MC00OGZmMGIwMmQwZWU=
Replace the id
in the following code:
Then add the user Id in the HTTP Headers:
"sg-user": "a1c5c9f7-acfb-451d-83f9-6226f174504b"
Finally, the response within the GraphQL will be as follows:
c. Read more about programs here
3. Optional a. Set the user's food preferences and restrictions b. Configure the user's meal plan settings
4. Get personalized suggestions for that user - Get personalized recipe suggestions - Get a meal plan
To execute queries and mutations it is required to include the following headers:
However not all the mutations and queries require the use of both headers. As follows, find the list of the endpoints that does not required the sg-user
header:
Mutations
Createuser
loginUser
requestResetPassword
resetPassword
generateMagicLink
createMealPlanTemplate
updateMealPlanTemplate
duplicateMealPlanTemplate
setMealPlanToTemplate
purchaseMealRecipe
updateSubscription
Queries
contentLibrary*
users programs*
restrictions*
mealPlanTemplates
foodLogsByUser
searchProfile labTestReports*
recommendedSwaps*
recipesByMealTime*
The ones marked with an asterisk (*) work with or without the sg-user
header.
Suggestic documentation has been divided into sections to help you find what you are looking for easily. Below, you can see how our documents are divided and organized:
CHANGELOG: Find the latest changes added in the application and documentation.
HELPFUL RESOURCES: Get started with the following useful resources:
Glossary: Find and familiarize yourself with the terms used through the API documentation.
FAQ: Find the common questions asked by our customers.
Integrations: Learn how to integrate our API solution with different applications.
GRAPHQL: Find how-to guides from how to Authenticate, get the API key to how to use the GraphQL playground.
SUGGESTIC API: Find the Suggestic API endpoints with examples ordered by:
Searches
Queries
Mutations.
OBJECTS: Find objects information and examples regarding nutrients, meal times, recipes, calories, meal plan, food logs, etc.
SUBSCRIPTION MANAGEMENT: Find information and examples about how to manage users' subscriptions.
Debugging an error? Have a question? Contact us by sending an email to hi@suggestic.com
Check out our changelog to see the recent changes that we've made to the Suggestic API.