Salesforce REST API Query - URL Limit
I am currently using the Salesforce REST API to fetch the records from Salesforce by passing the query via the query parameter in the GET request. However, this particular implementation returns an error when the url query parameter character count is more than 16000
. Is there a way to get it to accept around 1,00,000 chars in the url?
Answer
Unfortunately, it looks like you're just hitting the limits imposed by Salesforce:
SOSL search query strings
Maximum length of SearchQuery string
If the
SearchQuery
string is longer than 10,000 characters, no result rows are returned. IfSearchQuery
is longer than 4,000 characters, any logical operators are removed. For example, theAND
operator in a statement with aSearchQuery
that’s 4,001 characters will default to theOR
operator, which could return more results than expected.
I don't know the Salesforce API at all, but I have two suggestions (especially if no one else answers your question):
- Investigate a
POST
/PUT
based query option in the Salesforce REST API. I think I read something about being able to format a query in JSON and then submitting that instead (but I could be wrong). Edit: I looked a little more, and I didn't see anything immediately that said this was a possibility. - Use a less specific, and therefore smaller, query. If you're making this URL call from an application that you have control over (e.g., shell script, Java application, etc.), massage the data at that level and return a smaller subset of that data. If you're worried about getting too much data back at once, that shouldn't be a problem. It sounds like they limit the amount they send back per request and send a URL at the end of each response to the next page of results.
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM