First of all I am sorry if this question has already been asked and answered. I wasn’t able to find anything similar, but if you have, feel free to redirect me there.
I am using SuiteCRM Version 7.13.4.
I have created a Many-to-Many relationship between the Projects module and another custom module that I created, named Dependencies.
I wish to simulate the process of adding a new Dependency and then linking it to a specific Project, using API calls. If I understand correctly I will need to:
First send an API call that will create a new Dependency entry.
Get the ID of that entry.
Use this ID in a second API call, in order to link it with one of my Projects.
Is this correct?
Are there any API call examples that I can refer to in order to help me?
Capture the ID from the response of the first API call. Typically, SuiteCRM will include the ID in the response JSON.
Step 3: Link the Dependency with a specific Project
Send a second API call to link the Dependency with a specific Project using the IDs of both records.
Example API call (using cURL):
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"module1": "Projects",
"module1_id": "project_id", // Replace with the actual Project ID
"module2": "Dependencies",
"module2_id": "dependency_id", // Replace with the actual Dependency ID
"link_field_name": "dependencies", // Replace with the actual link field name
"name_value_list": {}
}' \
-u username:password \
http://your_suitecrm_url/service/v4_1/rest.php -v
Note: Always ensure the security of your API calls by using HTTPS and secure authentication methods. If possible, consider using OAuth2 for authentication in a production environment.
I edited your post - I hope you don’t mind - please check my edits by clicking the “pencil” icon, to learn the kinds of formatting available in these forums.