KREST API Documentation


#1

Hello!

I’m currently working with the KREST API, but the documentation is quite lacking.
I’ve been looking at this site: https://legacy.gitbook.com/book/spicecrm/krest
Is it going to get updated? If so, do you have any timeline?
Specifically I’m interested in handling related beans and relationship data.

Best Regards,
Chromate


#2

Chromate,
Thanks for your request! We usually take time to update documentation when someone asks for it.
I made some changes today and added information for related beans.
Hope you can get started.
Val


#3

Hi Val,

Thank you for the last response.
A follow-up question, how do i use the parameter searchterm and whereclause? Does it search all fields or does it search the sortfield specified? Could you give me an example using the searchterm and whereclause to find a specific field with a specific value?

Best Regards,
Chrome


#4

Hi Chrome,

I added a section “search” to KREST API. Currently having no success in publishing it :frowning:
Here the information you need

URL: /KREST/module/:modulename

Method: GET

Example

/KREST/module/Accounts

$params = array(
“searchterm” => “jbc banking”,
"searchtermfields => ‘[“name”, “description”]’,
“sortfield” => “date_entered”,
“sortdirection” => “desc”
);

Searchterm string will be chunked into pieces with whitespace as a separator. Query will search in specified searchtermfields where both terms are present.
Specify parameter searchtermfields to define fields to search in. If you forget you will get a database error (small bug in KREST to be corrected for fields of type link).

Response
{
“totalcount”: “1”,
“list”: [{
“id”: “1076fe7a-d0c2-2b39-654e-5bf6795a8e8d”,
“name”: “JBC Banking Inc”,
“date_entered”: “2018-11-22 09:38:04”,
“date_modified”: “2018-11-22 09:38:04”,
“modified_user_id”: “1”,
“modified_by_name”: “Administrator”,
“created_by”: “1”,
“created_by_name”: “Administrator”,
“assigned_user_id”: “seed_max_id”,
“assigned_user_name”: “Max Jensen”,
“account_type”: “Customer”,
… [all fields]…",
“accountccdetails”: {
“beans”: {},
“beans_relations_to_delete”: {}
},
“addresses”: {
“beans”: {},
“beans_relations_to_delete”: {}
},
“summary_text”: “JBC Banking Inc”,
“favorite”: 0,
“emailaddresses”: [{
“email_address”: “the70@example.biz”,
“email_address_caps”: “THE70@EXAMPLE.BIZ”,
“invalid_email”: “0”,
“opt_out”: “0”,
“date_created”: “2018-11-22 09:38:04”,
“date_modified”: “2018-11-22 09:38:04”,
“id”: “13a38286-b63e-d31a-3a0c-5bf679679390”,
“email_address_id”: “13e20b12-ab59-1535-2592-5bf679ba8132”,
“bean_id”: “1076fe7a-d0c2-2b39-654e-5bf6795a8e8d”,
“bean_module”: “Accounts”,
“primary_address”: “1”,
“reply_to_address”: “0”,
“deleted”: “0”
}],
“acl”: {
“list”: true,
“detail”: true,
“edit”: true,
“delete”: true,
“export”: true,
“import”: true
}
}]
}


#5

Excellent! Much appreciated :slight_smile:


#6

Hi Val,

Quick question, according to the documentation I can get the full list by setting the limit parameter to -99, however when trying this I get a database failure. Is this parameter changed?


#7

Hi Chrome,

could you post the database error?
Should be thrown in sugarcrm.log

Val