Forum Discussion

DavidNEGROBAR's avatar
DavidNEGROBAR
Qrew Member
3 years ago

Restful API how to update multiple records?

Hi,

I'm new to QB and API. I'm trying to update a field (checkbox) in a table for multiple records using an unique Key field.
I managed to update the field for one Key field, but failed to update multiple in one request.
My script for one record looks like :
{
"to": "ID of my table",
"data": [
{
"72": {
"value": "unique Key field"
},
"60": {
"value": true =>tick the checkbox
}
}
],
"fieldsToReturn": [
3
]
}
​Is there a simple way to run this action with multiple values for my FiD 72?
Thanks for your help.

------------------------------
David NEGROBAR
------------------------------

2 Replies

  • DougHenning1's avatar
    DougHenning1
    Community Manager

    The data parameter is an array of objects, with each object representing a record.  To update multiple records at once, just add additional record objects with the unique key value:

    {
        "to": "ID of my table",
        "data": [
            {
                "72": {
                    "value": "unique Key field 1"
                },
                "60": {
                    "value": true
                }
            },
            {
                "72": {
                    "value": "unique Key field 2"
                },
                "60": {
                    "value": true
                }
            }
        ],
        "fieldsToReturn": [
            3
        ]
    }

    Hope that helps!



    ------------------------------
    Doug Henning
    ------------------------------

  • Winss's avatar
    Winss
    Qrew Trainee

    In documentation it says as multiple record(s). But Not able to do after trying with different syntax.



    ------------------------------
    Winss
    ------------------------------