Skip to main content
Question

Restful API how to update multiple records?

  • November 5, 2021
  • 0 replies
  • 243 views

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
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+6
  • Registered
  • October 27, 2023

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



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

Forum|alt.badge.img+6

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