You need to sign in to do that
Don't have an account?
pbattisson
Rest query not working in different scenarios (apigee and iOS)
Hey Everyone
I was wondering if anybody had any idea as to why the following query is working in apigee and not in my iOS app.
iOS query:
https://na7.salesforce.com/services/data/v20.0/query/?q=Select Id, Name, Phone, Type, Website, AccountNumber, Site, AnnualRevenue, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry, ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, ShippingCountry, Description, NumberOfEmployees, Fax, Industry, Rating, Sic, TickerSymbol, Active__c, CustomerPriority__c, NumberofLocations__c, SLA__c, SLAExpirationDate__c, SLASerialNumber__c, UpsellOpportunity__c From Account order by Name -H "Authorization: OAuth myloongtoekngoeshere"
apigee (which provides its own token)
https://na7.salesforce.com/services/data/v20.0/query?q=Select Id, Name, Phone, Type, Website, AccountNumber, Site, AnnualRevenue, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry, ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, ShippingCountry, Description, NumberOfEmployees, Fax, Industry, Rating, Sic, TickerSymbol, Active__c, CustomerPriority__c, NumberofLocations__c, SLA__c, SLAExpirationDate__c, SLASerialNumber__c, UpsellOpportunity__c From Account order by Name
Thanks for any help guys and girls.
Paul
Looking through ZKSwitchboard, i don't think clientId is a sid, you want the sessionId property instead.
All Answers
the IOS one has .../query/?q=
the apigee one has .../query?q=
note the extra slash after query in the iOS version.
Nice but no cigar.
Where switcher is my ZKServerSwitchBoard instance and the error I receive is:
Error Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0x6b4c400 {NSUnderlyingError=0x6b1c6a0 "bad URL", NSLocalizedDescription=bad URL}
Thanks
Paul
You need to URL encode the queryString part.
Already tried both ASCII and UTF8 which both give
Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0x4e225a0 {NSErrorFailingURLKey=https://na7.salesforce.com/services/data/v20.0/query?q=Select%20Id,%20Name,%20Phone,%20Type,%20Website,%20AccountNumber,%20Site,%20AnnualRevenue,%20BillingStreet,%20BillingCity,%20BillingState,%20BillingPostalCode,%20BillingCountry,%20ShippingStreet,%20ShippingCity,%20ShippingState,%20ShippingPostalCode,%20ShippingCountry,%20Description,%20NumberOfEmployees,%20Fax,%20Industry,%20Rating,%20Sic,%20TickerSymbol,%20Active__c,%20CustomerPriority__c,%20NumberofLocations__c,%20SLA__c,%20SLAExpirationDate__c,%20SLASerialNumber__c,%20UpsellOpportunity__c%20From%20Account%20order%20by%20Name, NSErrorFailingURLStringKey=https://na7.salesforce.com/services/data/v20.0/query?q=Select%20Id,%20Name,%20Phone,%20Type,%20Website,%20AccountNumber,%20Site,%20AnnualRevenue,%20BillingStreet,%20BillingCity,%20BillingState,%20BillingPostalCode,%20BillingCountry,%20ShippingStreet,%20ShippingCity,%20ShippingState,%20ShippingPostalCode,%20ShippingCountry,%20Description,%20NumberOfEmployees,%20Fax,%20Industry,%20Rating,%20Sic,%20TickerSymbol,%20Active__c,%20CustomerPriority__c,%20NumberofLocations__c,%20SLA__c,%20SLAExpirationDate__c,%20SLASerialNumber__c,%20UpsellOpportunity__c%20From%20Account%20order%20by%20Name, NSUnderlyingError=0x4e20560 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)"}
:smileysad:
Would really need to see the raw HTTP request/response i think at this point.
-1012 seems to be kCFURLErrorUserCancelledAuthentication you should probably double check that you're sending the correct Authorization header.
Hey Simon
I ran the following
NSDictionary *header = [request allHTTPHeaderFields];
NSData *body = [request HTTPBody];
and got back
where tokenY is the ZKSwitchboard clientId and the URL in the request being
I am stumped. Going to start over again looking in the morning. Thanks for all your help.
Paul
Looking through ZKSwitchboard, i don't think clientId is a sid, you want the sessionId property instead.
Using the session Id has helped sort it out along with setting some more header fields (namely content-type).
Thanks for all the help Simon. Much appreciated.
Paul