0

SFDC returns a BadRequest: URI Scheme is too long for the following query.

services/data/v39.0/query/?q=SELECT Id, Name FROM Contact WHERE Viewer_Locked_By_Date_UTC__c < 2017-12-05T22:39:37Z LIMIT 2000 OFFSET 0

I believe it has something to do with:

Viewer_Locked_By_Date_UTC__c < 2017-12-05T22:39:37Z

But don't know why...can anyone explain how to compare a DateTime via Force.com API?

0

You've got two issues. First, you forgot the FROM <ObjectName>. Second, you need to encode your spaces as %20. The final result should look something like this:

/services/data/v39.0/query/?q=SELECT%20Id,Name%20FROM%20Contact%20WHERE
%20Viewer_Locked_By_Date_UTC__c%20<%202017-12-05T22:39:37Z%20LIMIT%202000%20OFFSET%200

(Line break added for legibility and should not be included in the actual URL).

  • Valid reply, but I expect the tooling (.net client) to encode. Accidentally deleted my from statement. I will add one in as you suggest. – tmc Dec 5 '17 at 23:26
  • @tmc I haven't seen a client that does this automatically, on the assumption that it could get it wrong (URI path and URI query parameters are encoded differently). Check the manual for your language to confirm. – sfdcfox Dec 5 '17 at 23:29
  • I wish I could up vote you, as it appears to be something in the client. Query works in the Develop Console. – tmc Dec 5 '17 at 23:33
  • The developer console does the encoding for you when you use the Query tab. If you're using, say, the REST Explorer, you have to do it yourself. – sfdcfox Dec 5 '17 at 23:36
  • Unfortunately, Uri Escaping did not solve my issue. I am thinking there may be a .Net bug or something. I will try the REST explorer. Thanks for the tip! – tmc Dec 5 '17 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.