# What Parameter in KREST I can use to set or get data from database

**URL:** <https://community.spicecrm.io/t/what-parameter-in-krest-i-can-use-to-set-or-get-data-from-database/175>\
**Category:** Uncategorized\
**Created:** [September 20, 2017, 6:08am UTC](https://community.spicecrm.io/t/what-parameter-in-krest-i-can-use-to-set-or-get-data-from-database/175 "2017-09-20T06:08:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrian](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@adrian](https://community.spicecrm.io/u/adrian)\
**Post date:** [September 20, 2017, 6:08am UTC](https://community.spicecrm.io/t/what-parameter-in-krest-i-can-use-to-set-or-get-data-from-database/175/1 "2017-09-20T06:08:59Z")

</div>

What Parameter I can use to get or set data from database with KREST ?

---

<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:** [September 20, 2017, 8:10am UTC](https://community.spicecrm.io/t/what-parameter-in-krest-i-can-use-to-set-or-get-data-from-database/175/2 "2017-09-20T08:10:50Z")

</div>

Adrian,

1. login  
You wil have to login to CRM with KREST per GET method  
endpoint = [your site url]/KREST/login?user\_name=[user name]&password=[md5 of your password]  
Example: [http://localhost/myspicecrm/KREST/login?user\_name=admin&password=b8a383899c1be0dd974fc597f19b668b](http://localhost/myspicecrm/KREST/login?user_name=admin&password=b8a383899c1be0dd974fc597f19b668b)

The login will return a session ID (id property)  
`{"id":"r4vin79ra6uislpd5smpncalv5","userid":"1","user_name":"admin","first_name":"","last_name":"Administrator"}`

Pass this session ID to any other call

1. to get a specific record by id  
endpoint = [your site url]/KREST/module/[module name]/[record id]  
method GET  
Use same url with method post to update a record.  
Example on Account  
endpoint= [http://localhost/myspicecrm/KREST/module/Accounts/32b78947-0ab5-9cbe-5ddc-550838fa5558?session\_id=r4vin79ra6uislpd5smpncalv5](http://localhost/myspicecrm/KREST/module/Accounts/32b78947-0ab5-9cbe-5ddc-550838fa5558?session_id=r4vin79ra6uislpd5smpncalv5)

2. to create a record  
You have to provide an ID (a GUID) for the record. Have a look at include/utils.php function create\_guid() to get an idea of how to generate one.  
In next KREST Release we will implement an endpoint to create a GUID.  
Use endpoint as in a GET but use POST

Documentation about KREST is being developed, should be issued this year.

---

<div class="post-metadata">

**Author:** ![adrian](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@adrian](https://community.spicecrm.io/u/adrian)\
**Post date:** [September 20, 2017, 9:32am UTC](https://community.spicecrm.io/t/what-parameter-in-krest-i-can-use-to-set-or-get-data-from-database/175/3 "2017-09-20T09:32:23Z")

</div>

Marvetal,

Thankyou very much. I have tried it and it’s succeed.
