# REST API PUT example

**URL:** <https://community.dreamfactory.com/t/rest-api-put-example/2508>\
**Category:** REST API\
**Created:** [April 7, 2016, 7:43pm UTC](https://community.dreamfactory.com/t/rest-api-put-example/2508 "2016-04-07T19:43:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![m\_menon](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@m\_menon](https://community.dreamfactory.com/u/m_menon)\
**Post date:** [April 7, 2016, 7:43pm UTC](https://community.dreamfactory.com/t/rest-api-put-example/2508/1 "2016-04-07T19:43:43Z")

</div>

Can I have a simple example on how to use platform.api.put to update a single record in the db (included SQLite database) service using a where clause. I want to only update only 1 field. Something similar to the below SQL query, just to make it more clear

`Update tblExample set name='John Doe' where lastname = 'doe'`

How do I achieve the same with a REST API. I guess I’d need to use PUT method.

Thanks,  
M.M

---

<div class="post-metadata">

**Author:** ![andersonmuller](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@andersonmuller](https://community.dreamfactory.com/u/andersonmuller)\
**Post date:** [April 7, 2016, 9:31pm UTC](https://community.dreamfactory.com/t/rest-api-put-example/2508/2 "2016-04-07T21:31:12Z")

</div>

Hi @m_menon,

Try this:

```
payload = {
  "resource": [
    {
      "name": "John Doe"
    }
  ],
  "filter": "lastname=doe"
};

result = platform.api.put("db/_table/tblExample", payload);
```

---

<div class="post-metadata">

**Author:** ![jimijon](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jimijon/32/718_2.png) [@jimijon](https://community.dreamfactory.com/u/jimijon)\
**Post date:** [July 24, 2016, 3:45pm UTC](https://community.dreamfactory.com/t/rest-api-put-example/2508/3 "2016-07-24T15:45:52Z")

</div>

I can’t get the PUT to work. I get 500 error:

“message”: “Failed to update records in ‘Products’.\nFirst key in $update argument is not an update operator”

my request is:

```
{
"resource": [{
	"filename": "Greg-London/JPMC.CSV",
	"products": {
		"data": [{
			"Details": "CREDIT",
			"Posting Date": "6/13/2016",
			"Description": "BTQ DEPOSIT",
			"Amount": "886.07",
			"Type": "MISC_CREDIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "6/8/2016",
			"Description": "DEPOSIT ID NUMBER 298979",
			"Amount": "1446.28",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "6/6/2016",
			"Description": "DEPOSIT ID NUMBER 998146",
			"Amount": "1609.51",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "6/6/2016",
			"Description": "DEPOSIT ID NUMBER 298929",
			"Amount": "1215.00",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "6/3/2016",
			"Description": "REMOTE ONLINE DEPOSIT # 1",
			"Amount": "250.00",
			"Type": "CHECK_DEPOSIT",
			"Check or Slip #": "1",
			"": ""
		}, {
			"Details": "CREDIT",
			"Posting Date": "6/2/2016",
			"Description": "ODP TRANSFER FROM SAVINGS 000003357125680",
			"Amount": "250.00",
			"Type": "MISC_CREDIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "6/1/2016",
			"Description": "REMOTE ONLINE DEPOSIT # 1",
			"Amount": "600.00",
			"Type": "CHECK_DEPOSIT",
			"Check or Slip #": "1",
			"": ""
		}, {
			"Details": "CREDIT",
			"Posting Date": "5/31/2016",
			"Description": "ODP TRANSFER FROM SAVINGS 000003357125680",
			"Amount": "250.00",
			"Type": "MISC_CREDIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/26/2016",
			"Description": "DEPOSIT ID NUMBER 298591",
			"Amount": "200.00",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "CREDIT",
			"Posting Date": "5/25/2016",
			"Description": "ODP TRANSFER FROM SAVINGS 000003357125680",
			"Amount": "200.00",
			"Type": "MISC_CREDIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/23/2016",
			"Description": "DEPOSIT ID NUMBER 298513",
			"Amount": "250.00",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/19/2016",
			"Description": "DEPOSIT ID NUMBER 298162",
			"Amount": "854.00",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "CREDIT",
			"Posting Date": "5/18/2016",
			"Description": "ODP TRANSFER FROM SAVINGS 000003357125680",
			"Amount": "100.00",
			"Type": "MISC_CREDIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/17/2016",
			"Description": "REMOTE ONLINE DEPOSIT # 1",
			"Amount": "400.00",
			"Type": "CHECK_DEPOSIT",
			"Check or Slip #": "1",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/16/2016",
			"Description": "DEPOSIT ID NUMBER 998303",
			"Amount": "1913.51",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/16/2016",
			"Description": "DEPOSIT ID NUMBER 998305",
			"Amount": "290.00",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/16/2016",
			"Description": "DEPOSIT ID NUMBER 998304",
			"Amount": "120.00",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/13/2016",
			"Description": "REMOTE ONLINE DEPOSIT # 1",
			"Amount": "1500.00",
			"Type": "CHECK_DEPOSIT",
			"Check or Slip #": "1",
			"": ""
		}, {
			"Details": "CREDIT",
			"Posting Date": "5/10/2016",
			"Description": "ODP TRANSFER FROM SAVINGS 000003357125680",
			"Amount": "750.00",
			"Type": "MISC_CREDIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/9/2016",
			"Description": "DEPOSIT ID NUMBER 848056",
			"Amount": "2055.00",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "CREDIT",
			"Posting Date": "5/6/2016",
			"Description": "ODP TRANSFER FROM SAVINGS 000003357125680",
			"Amount": "100.00",
			"Type": "MISC_CREDIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/5/2016",
			"Description": "DEPOSIT ID NUMBER 833671",
			"Amount": "100.00",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/5/2016",
			"Description": "DEPOSIT ID NUMBER 833670",
			"Amount": "20.00",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/3/2016",
			"Description": "DEPOSIT ID NUMBER 833931",
			"Amount": "400.00",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/3/2016",
			"Description": "DEPOSIT ID NUMBER 833930",
			"Amount": "223.96",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": "DSLIP",
			"Posting Date": "5/2/2016",
			"Description": "DEPOSIT ID NUMBER 833883",
			"Amount": "1117.14",
			"Type": "DEPOSIT",
			"Check or Slip #": "",
			"": ""
		}, {
			"Details": ""
		}],
		"errors": [{
			"type": "FieldMismatch",
			"code": "TooFewFields",
			"message": "Too few fields: expected 7 fields but parsed 1",
			"row": 26
		}],
		"meta": {
			"delimiter": ",",
			"linebreak": "\r\n",
			"aborted": false,
			"truncated": false,
			"cursor": 1851,
			"fields": ["Details", "Posting Date", "Description", "Amount", "Type", "Check or Slip #", ""]
		}
	},
	"processed": "F",
	"date": "2016-07-24T15:43:24.118Z"
}],
"filter": "filename=Greg-London/JPMC.CSV"

```

}

Anything obvious?
