Help Steps For Suite CRM API Methods URL and Param

Hello I want Login Rest API for Suite CRM And Contact Rest API in SuiteCRM Version 7.11.8
Please respond to me with API URL, Method, and PARAM Structure for the postman.

Hi,
welcome to the Suite-community!

please have a look in Api\docs\, there is a postman collection and a nice swagger file. These examples along with this tutorial

…should cover most of your questions.

I have been checked whole this document but there is no one any login or contact REST API.

So please give me best suggestion. For this login REST API and Contact REST API for SuiteCRM Version 7.11.8.

is there any need to use the newer v8-api or could you use the v4 api as well?

v8:

  • endpoint: {{crm-url}}/Api/access_token
    • body: x-www-form-encoded
    • grant_type=client_credentials
    • client_id= some id
    • client_secret=some secret
    • credentials (id/secret) have to be created first using (…index.php?module=OAuth2Clients&action=index)

v4 uses:

  • endpoint: {{crm-url}}/service/v4_1/rest.php
    • body: x-www-form-encoded
    • input_type: JSON
    • response_type: JSON
    • method: login
    • rest_data: a json containing something like:
{
	"user_auth": {
		"user_name": "{{rest4user}}",
		"password": "{{rest4pw}}",
		"version": "1"
	},
	"application_name": "RestTest"
}

username and password are the same as for regular users (note: password has to be md5-hashed first).

Edit:

yes, there is. The manual is meant vor v8 and this section is summarizing the login:

if you’re more interested in v4, have a look here. There are explicit examples as well:

1 Like

Getting V8 response 404 - File or directory not found. html error when i am using this endpoint: {{crm-url}}/Api/access_token with my instance

But i am success full login response from v4_1
{{crm-url}}/service/v4_1/rest.php with my instance

So how can i get login response using V8 method?

Have you completed all steps that are described in “before you start calling endpoints”?

Done using v4_1 Method. Thank You.

I need to create contacts rest API using the v4_1 method.

Hi,
set_entry should work for you, the rest_data could look like

{	
    "session" : "{{sessionid}}",
	"module_name" : "Contacts",
	"name_value_list" : {
		"first_name" : "J.",
        "last_name" : "B.",
	    "description" : "some text"
	}
}

->

  /**
     * Update or create a single SugarBean.
     *
     * @param String $session -- Session ID returned by a previous call to login.
     * @param String $module_name -- The name of the module to return records from.  This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..
     * @param Array $name_value_list -- The keys of the array are the SugarBean attributes, the values of the array are the values the attributes should have.
     * @param Bool $track_view -- Should the tracker be notified that the action was performed on the bean.
     * @return Array    'id' -- the ID of the bean that was written to (-1 on error)
     * @exception 'SoapFault' -- The SOAP error, if any
     */
    Method [  public method set_entry ] {
      

      - Parameters [4] {
        Parameter #0 [  $session ]
        Parameter #1 [  $module_name ]
        Parameter #2 [  $name_value_list ]
        Parameter #3 [  $track_view = false ]
      }
    }

i got this type of response in postman.

==>

{
“name”: “An Undefined Error - invalid_call occurred”,
“number”: “-1”,
“description”: “There is no error definition for invalid_call”
}

I try this
http://example.com/service/v4_1/rest.php

session:v5slogsanf09s3b9uvjv3olicb
module_name:Contacts
name_value_list:{“first_name” : “J.”, “last_name” : “B.”, “description” : “some text”}
input_type:JSON
response_type:JSON

and got this response
{
“name”: “An Undefined Error - invalid_call occurred”,
“number”: “-1”,
“description”: “There is no error definition for invalid_call”
}
_
But cannot creat new contact. Please give me exact default suite crm v4_1 rest api.

Is it available Default Suite CRM Contacts Rest API for v4_1 method ?

How did you get the session id? I just want to confirm that you were successfully able to login.

Afterwards I can provide you a postman example if necessary.

Yes i got session id from this login api
http://example.com/service/v4_1/rest.php
input_type:JSON
response_type:JSON
method:login
rest_data:{“user_auth”:{“user_name”:“AnkitL”,“password”:“7c71698700f3e49fe78aec9f2494db8c”,“version”:“1”},“application”:“RestTest”}

Response :
{
“id”: “v5slogsanf09s3b9uvjv3olicb”,
“module_name”: “Users”,
“name_value_list”: {
“user_id”: {
“name”: “user_id”,
“value”: “2d8aad88-5722-4ae2-0198-5e9f0e1b27eb”
},
“user_name”: {
“name”: “user_name”,
“value”: “AnkitL”
},
“user_language”: {
“name”: “user_language”,
“value”: “en_us”
},
“user_currency_id”: {
“name”: “user_currency_id”,
“value”: “-99”
},
“user_is_admin”: {
“name”: “user_is_admin”,
“value”: false
},
“user_default_team_id”: {
“name”: “user_default_team_id”,
“value”: null
},
“user_default_dateformat”: {
“name”: “user_default_dateformat”,
“value”: “m/d/Y”
},
“user_default_timeformat”: {
“name”: “user_default_timeformat”,
“value”: “h:ia”
},
“user_number_seperator”: {
“name”: “user_number_seperator”,
“value”: “,”
},
“user_decimal_seperator”: {
“name”: “user_decimal_seperator”,
“value”: “.”
},
“mobile_max_list_entries”: {
“name”: “mobile_max_list_entries”,
“value”: null
},
“mobile_max_subpanel_entries”: {
“name”: “mobile_max_subpanel_entries”,
“value”: null
},
“user_currency_name”: {
“name”: “user_currency_name”,
“value”: “US Dollars”
}
}
}

I taken this id for session id

Is it available defaut rest api for contacts in v4_1 method ?

Hi,
yes, all modules (no matter if custom or factory ones) are available using the api. I will provide an example.

Edit:

Give me Contacts Rest api for v4_1 method only at now please.

The previous example is using set_entry, which creates a new contact in this case.

1 Like

I used this same thing just like your postman example but i’m got this error every time. please check my attachment in thhis reply