What is the use of done attribute in Salesforce REST API response?

What is the use of done attribute in Salesforce REST API response?

Done attribute is used to find whether the result is batched. If done is false, then the result is batched and nextRecordsUrl will have the next set of records.

The result from using nextRecordsUrl will contain similar information, used to determine if there are more batches providing a new nextRecordsUrl value to retrieve them.


Response example when done is true:

{
“done” : true,
“totalSize” : 2,
“records” :
[
{
“attributes” :
{
“type” : “Account”,
“url” : “/services/data/v20.0/sobjects/Account/001D000000IRFmaIAH”
},
“Name” : “Test 1”
},
{
“attributes” :
{
“type” : “Account”,
“url” : “/services/data/v20.0/sobjects/Account/001D000000IomazIAB”
},
“Name” : “Test 2”
}
]
}


Response example when done is false:


{
“totalSize” : 1000,
“done” : false,
“nextRecordsUrl” : “services/data/v27.0/query/01g30000001NpqhAAC”,
“records” :
[
{
“attributes” :
{
“type” : “Account”,
“url” : “/services/data/v20.0/sobjects/Account/001D000000IRFmaIAH”
},
“Name” : “Test 1”
},
{
“attributes” :
{
“type” : “Account”,
“url” : “/services/data/v20.0/sobjects/Account/001D000000IomazIAB”
},
“Name” : “Test 2”
},
………………………………
]
}

Leave a Reply