Getting Started
This guide will help you to start using the Suggestic API
Last updated
Was this helpful?
This guide will help you to start using the Suggestic API
Last updated
Was this helpful?
Suggestic application uses query language and the , as a graphical, interactive, in-browser GraphQL IDE, to allow users to execute 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 .
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:
Suggestic provides an environment where you can run and test the API.
Name
URL
Production
https://production.suggestic.com/graphql
The order of implementation should be:
Finally,
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:
Add the above code into the GraphQL playground. The list of all available programs is displayed:
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:
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.
Check out our changelog to see the recent changes that we've made to the Suggestic API.
b. Depending on your case, review if the you are using fits your requirements.
2. Check the section to start using the to execute queries and mutations
Use to start executing queries and mutations. The examples are separated into tabs as in the image below::
and
Add a
Note: Use the mutation to get the user ID, it will be used later to execute queries and mutations.
b. Obtain a of all available diets and programs by using the following code:
c. the user recently created to a program
c. Read more about programs
3. Optional a. Set the user's food preferences and b. Configure the user's
4. Get personalized suggestions for that user - Get personalized - Get a
Debugging an error? Have a question? Contact us by sending an email to