user10006577
user10006577

Reputation: 1

400 error respond code

I've got 400 error. There is something wrong after AND..

URL that is not working:

URL url = new URL(SeleniumProperties.getUrlRefreshVer() + "/services/data/v36.0/query/?q=SELECT+QPConfig_Decimal_NetPrice__c+FROM+Apttus_Proposal__Proposal_Line_Item__c+" + "WHERE+Apttus_Proposal__Proposal__c+=+'" + quoteId + "' + "AND+Apttus_QPConfig__ChargeType__c+=+'Freight Fee'");

when I use below it is working:

URL url = new URL(SeleniumProperties.getUrlRefreshVer() + "/services/data/v36.0/query/?q= SELECT+QPConfig_Decimal_NetPrice__c+FROM+Apttus_Proposal__Proposal_Line_Item__c+" + "WHERE+Apttus_Proposal__Proposal__c+=+'" + quoteId + "');

there is something wrong after AND

Can anybody help?

Upvotes: 0

Views: 65

Answers (2)

Peter Kühne
Peter Kühne

Reputation: 3274

It looks like you have are missing a quote mark in your string concatenation:

URL url = new URL(SeleniumProperties.getUrlRefreshVer() + "/services/data/v36.0/query/?q=SELECT+QPConfig_Decimal_NetPrice__c+FROM+Apttus_Proposal__Proposal_Line_Item__c+" + "WHERE+Apttus_Proposal__Proposal__c+=+'" + quoteId + "' + AND+Apttus_QPConfig__ChargeType__c+=+'Freight Fee'");

Upvotes: 1

AmmoPT
AmmoPT

Reputation: 958

400 Bad Request HTTP Error

The 400 Bad Request Error is an HTTP response status code that indicates that the server was unable to process the request sent by the client due to invalid syntax

The important part in that quote is the invalid syntax part, which means you're not forming the URL correctly, and to prevent that, you should use a proper IDE with highlighting (or even Stackoverflow code blocks) to make it obvious for you, through coloring, where the syntax error lies.

With that said, a couple things are wrong in your URL, syntax wise, use this instead:

URL url = new URL(SeleniumProperties.getUrlRefreshVer() + "/services/data/v36.0/query/?q=SELECT+QPConfig_Decimal_NetPrice__c+FROM+Apttus_Proposal__Proposal_Line_Item__c+" + "WHERE+Apttus_Proposal__Proposal__c+=+'" + quoteId + "' + AND+Apttus_QPConfig__ChargeType__c+=+'Freight Fee'");

Upvotes: 0

Related Questions