Search code examples
javasalesforcesoql

I am using SOQL for accessing the data of salesforce using java


String uri = baseUri + "/query?q=Select+Id+from+Account+where+Id=+ ('017F00000nqmNPQAY')";

I am using SOQL for querying the data, it is working fine without where clause, but I don't know how to write it with where clause, It is throwing error when I am trying the above syntax. How can I resolve this?


Solution

  • Why not do something like this:

    URIBuilder ubuilder = new URIBuilder(baseUri);
    ubuilder.setPath("/services/data/v39.0/query/")
       .setParameter("q", "SELECT Id, Name FROM Account WHERE Id = '017F00000nqmNPQAY'");
    HttpGet request = new HttpGet(ubuilder.build());