4

Goal: Get all Account records with all fields via REST API

Approach: Send GET request with query:

/services/data/v53.0/query?q=SELECT+FIELDS(ALL)+FROM+Account+ORDER+BY+Name+ASC+LIMIT+200

Problem: I have over 1000 objects, but since I'm using FIELDS() I need to include a LIMIT clause. I am expecting a nextRecordsUrl for the remaining objects, however I don't receive one in the response.

Possible workaround: Use OFFSET to get remaining objects until response is empty. This means I would be sending an additional query to check if I've received all objects.

Would appreciate any advice. Thanks!

2
  • 2
    welcome! good first question. Are you trying to accomplish something specific (data replication to an external database/backup)? There's also a sObject Describe that would provide you with all fields to leverage in your query to avoid using FIELDS(ALL) which is stopping you from leveraging nextRecordsUrl. Dec 23, 2021 at 22:50
  • Thanks @KrisGoncalves! I'm building an API client which will be used by multiple teams to get data from SF. The goal is to make the client as simple as possible for the consumer, so we want to return all fields and deserialize to a custom object rather than requiring the consumer the fields they want (because they would need to know how the field is named in SF).
    – gorbital
    Dec 27, 2021 at 23:55

1 Answer 1

3

There's no nextUrl because of the LIMIT clause. If you need all fields without restriction, you need to do a describe call to get all fields, which you can cache for later use, then build a query based those results.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .