Post

1 follower Follow
0
Avatar

Facing issue during query to Clarizen objects from salesforce through http call out

Hi,

I am referring the Clarizen Rest Api Guide  https://success.clarizen.com/entries/57664667-Clarizen-REST-API to make call out to Clarizen. However I became successful to send login request and received "UserId,sessionId,organizationId,serverTime,licenseType" as the response with [Status=OK, StatusCode=200] .

But I am facing the issue when I want to make a query to fetch Timesheet object fields after getting successfully Login response.

This is the exception which I am receiving during the callout 

"errorCode": "LoginFailure", 

"message": "Authentication cookie is missing. Did you forget to login?", 

"referenceId": "hmHpu9JvvEKr~SiJGCaAVw"

This is my code which I have used to make query

String strRequest = '{typeName:"Timesheet",fields:["createdBy"]}'; 

httpReq.setHeader('Content-Length', String.valueOf(strRequest.length())); 

httpReq.setHeader('Content-Type', 'text/JSON');

httpReq.setMethod('POST'); 

httpReq.setEndpoint(' https://api2.clarizen.com/v1.0/services/data/entityQuery'); 

httpReq.setHeader('SESSIONID', 'USID='+sessioinId); 

httpReq.setBody(strRequest);

Http http = new Http();

HttpResponse res = http.send(httpReq);

Please help me.

I have tried by modifying the request in so many ways but same exception I am getting.

Thank you in advance

John Gray Answered

Please sign in to leave a comment.

1 comment

0
Avatar

Hi John,

I think the session Id is expected in a cookie, not in a header.

Please review the documentation.

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink