# KREST API Documentation

**URL:** <https://community.spicecrm.io/t/krest-api-documentation/359>\
**Category:** Uncategorized\
**Created:** [October 18, 2018, 6:23am UTC](https://community.spicecrm.io/t/krest-api-documentation/359 "2018-10-18T06:23:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chromate](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@Chromate](https://community.spicecrm.io/u/Chromate)\
**Post date:** [October 18, 2018, 6:23am UTC](https://community.spicecrm.io/t/krest-api-documentation/359/1 "2018-10-18T06:23:11Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![maretval](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@maretval](https://community.spicecrm.io/u/maretval)\
**Post date:** [October 18, 2018, 12:03pm UTC](https://community.spicecrm.io/t/krest-api-documentation/359/2 "2018-10-18T12:03:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chromate](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@Chromate](https://community.spicecrm.io/u/Chromate)\
**Post date:** [January 9, 2019, 9:37am UTC](https://community.spicecrm.io/t/krest-api-documentation/359/3 "2019-01-09T09:37:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![maretval](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@maretval](https://community.spicecrm.io/u/maretval)\
**Post date:** [January 9, 2019, 2:55pm UTC](https://community.spicecrm.io/t/krest-api-documentation/359/4 "2019-01-09T14:55:34Z")

</div>

Hi Chrome,

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

**URL** : /KREST/module/:modulename

**Method** : GET

 ![grafik](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/c4242b0b8417dd618453bbb4bfadbd5b08d232ac.png)

**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  
}  
}]  
}

---

<div class="post-metadata">

**Author:** ![Chromate](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@Chromate](https://community.spicecrm.io/u/Chromate)\
**Post date:** [January 9, 2019, 3:03pm UTC](https://community.spicecrm.io/t/krest-api-documentation/359/5 "2019-01-09T15:03:26Z")

</div>

Excellent! Much appreciated 🙂

---

<div class="post-metadata">

**Author:** ![Chromate](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@Chromate](https://community.spicecrm.io/u/Chromate)\
**Post date:** [January 16, 2019, 1:36pm UTC](https://community.spicecrm.io/t/krest-api-documentation/359/6 "2019-01-16T13:36:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![maretval](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@maretval](https://community.spicecrm.io/u/maretval)\
**Post date:** [January 16, 2019, 5:40pm UTC](https://community.spicecrm.io/t/krest-api-documentation/359/7 "2019-01-16T17:40:52Z")

</div>

Hi Chrome,

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

Val
