-
-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for retrieving a Document is in error #301
Comments
This doesn't seem to match up with what is mentioned in the Salesforce docs - see https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_document.htm. The docs seem to suggest that documents can point to a URL or encoded data. What happens if you select |
This appears to be a bug (or, I'm sure they'll call it 'working as designed') in the Salesforce REST API If you run a SOQL query through the API like:
(the LIMIT 2002 ensures that you get a nextRecordsUrl) The first 'page' worth of records just has the URL to the Document Body field But when you retrieve the 'nextRecordsUrl' for that same query, you see that only a single record is returned and it contains the actual binary content of the Body field And notice that the 'nextRecordsUrl' is for offset 2001, not 4000 as you'd expect for a normal query result This behavior of only returning the Body content if a single record is retrieved is hinted at here: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_attachment.htm
The bug seems to be that we should've gotten "an error" by getting more than a single record back in the SOQL query .. instead, we get this bizarro behavior where it returns 2000 records in the first chunk, then only a single record for each page thereafter Can you update the README to reflect this silliness? Because the Restforce::Collection masks the intricacies of the paginated results, you're left totally lost as to what's happening. You can probably just link to this bug report. |
@daveespo Makes sense! Fancy making a PR for that readme tweak? 😄 |
#301 - Documents nuanced behavior in REST API for BLOB field retrieval
I tried following the example here: https://github.com/ejholmes/restforce#documents to download the body of a Document and save it to a file. This didn't work for me. Examination of document.Body shows that it contains a URL, like this: /services/data/v35.0/sobjects/Document/0155C00000053lWQAQ/Body for retrieving the body. To correctly retrieve the document body you must do the following:
The text was updated successfully, but these errors were encountered: