function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arun MKArun MK 

Integration with Pivotal Tracker through API

Hey, I am trying to integrate salesfprce pivotal tracker. I am having some problem while trying to add a story to the project through API. I am able to get the access token. 
Can someone tell me what is the mistake that I am doing here in my code? 

My Sample Code: 

HTTPRequest req = new HTTPRequest(); 
req.setHeader('Authorization', 'Basic ' + EncodingUtil.base64Encode(Blob.valueOf(accessToken))); 
req.setHeader('Content-type:','application/json'); 
req.setMethod('POST'); 
req.setEndpoint(Label.Pivotal_Tracker_End_Point_URL+'368415/stories'); 
req.setBody('{"name":"Exhaust ports are ray shielded"}'); 
req.setCompressed(true); 
HTTPResponse resp = new HTTPResponse(); 
resp = h.send(req); 

Error that I got: 

"kind": "error", 
"error": "Authorization failure.", 
"possible_fix": "Your project permissions are determined on the Project Membership page. If you are receiving this error you may be trying to access the wrong project, or the project API access is disabled, or someone listed as the project's Owner needs to change your membership type.", 
"code": "unauthorized_operation", 
"general_problem": "You aren't authorized to access the requested resource." 


However when I try to add a story through the Advanced REST Client from google chrome, it was successful. So, it should be something wrong in my code.