API 開發指南
遇到問題了嗎?不用擔心,答案都在這。
全站搜尋

Modifying an Entry

The endpoint for modifying an entry is the same as reading an existing entry. Notice that when you create an entry, the endpoint points to a Ragic sheet, but when you edit an entry, your endpoint will need an extra record id to point to the exact record.


https://www.ragic.com/<account>/<tab folder>/<sheet index>/<record id>?api

All you need to provide is the field ids of the fields that you would like to modify to. If the field is a date field the value will need to be in the format of yyyy/MM/dd or yyyy/MM/dd HH:mm:ss if there's a time part.


curl -F "2000123=Dunder Mifflin" \

-F "2000127=Jim Halpert" \

-F "api=" \

-H "Authorization:Basic YOUR_API_KEY_GOES_HERE" \

https://www.ragic.com/demo/sales/1/3

The equivalent JSON format is as below,

{

"2000123": "Dunder Mifflin",

"2000127": "Jim Halpert"

}

For subtables, it's a bit more tricky. Because Ragic will need to know which row that you're editing. So you will need to find the row id of the row that you're editing. This information can be found from an API call.

As we mentioned in earlier chapter, the returned format for an entry with subtables look like this:


"_subtable_2000154": {

"0": {

"Contact Name": "Jeff Kuo",

"Title": "Technical Manager",

"Phone": "886-668-037",

"E-mail": "jeff@ragic.com",

...

...

},

"1": {

"Contact Name": "Amy Tsai",

"Title": "Marketing",

"Phone": "",

...

...

},

"2": {

"Contact Name": "Allie Lin",

"Title": "Purchasing",

...

...

In the subtable, 1 is the row id for the contact Amy Tsai, and 2 is the row id for the contact Allie Lin. With this row id, you can modify data in the subtable pretty much like how you create an entry with subtable data.

You use the row id as the identifier following the field id. You only need to put in the fields that you want to modify:

2000147_1=Ms. Amy Tsai

2000148_1=Senior Specialist

2000148_2=Senior Manager

The whole request would be like this:

curl -F "2000123=Dunder Mifflin" \

-F "2000127=Jim Halpert" \

-F "2000147_1=Ms. Amy Tsai" \

-F "2000148_1=Senior Specialist" \

-F "2000148_2=Senior Manager" \

-F "api=" \

-H "Authorization:Basic YOUR_API_KEY_GOES_HERE" \

https://www.ragic.com/demo/sales/1/3

The equivalent JSON format is as below,

{

"2000123": "Dwight Schrute",

"2000127": "Jim Halpert" ,

"_subtable_2000154": {

"29" :{

"2000147": "Ms. Amy Tsai",

"2000148": "Senior Specialist"

},

"30" :{

"2000148": "Senior Manager"

}

}

}

If you want to delete a subtable row, you can create a request like:

DELSUB_<subtable key>=<subtable row id>

The equivalent JSON format is as below,

_DELSUB_<subtable key>=[<subtable row id>,<subtable row id>,...,<subtable row id>];

For example, if you want to delete the contact Arden Jacobs, the whole request would be like this:

curl -F "DELSUB_2000154=3" \

-F "api=" \

-H "Authorization:Basic YOUR_API_KEY_GOES_HERE" \

https://www.ragic.com/demo/sales/1/3

The equivalent JSON format is as below,

{

"_DELSUB_2000154": [3]

}

Using the JSON format for subtable row deletion allows you to specify multiple rows in a simple manner,

{

"_DELSUB_subtable key": [<subtable row id>,..., <subtable row id>]

}

回最上面 目錄

馬上註冊
免費試用 Ragic!

用 Google 帳號註冊

立即科技 Ragic, Inc.
02-7728-8692
台北市中正區南昌路二段81號9樓