• pavan bommana 5
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
I want the session id of the org which is logged on another tab through apex or visual force or lightning javascript
I am able to create a userstory with this api in POSTMAN but it is showing error in apex class.
public class rallyIntegrate {
    public string variable;
    public string securityToken;
    public void getSourcetoken(){
       HTTP h = new HTTP();
        HTTPRequest r = new HTTPRequest();        
        r.setEndpoint('https://rally1.rallydev.com/slm/webservice/v2.0/security/authorize');
        Blob headerValue = Blob.valueOf(UserName+ ':' +Password );
        String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
        r.setHeader('Authorization', authorizationHeader);
        r.setMethod('GET');
        HTTPResponse resp = h.send(r);
        system.debug('34====='+resp.getStatus());
        system.debug('35====='+resp.getStatusCode());
        system.debug('35====='+resp.getBody());
        variable = resp.getBody();
        system.debug('===+++'+variable.substringAfter('OperationResult').substringBetween('SecurityToken": "','"}}')); 
         securityToken = variable.substringAfter('OperationResult').substringBetween('SecurityToken": "','"}}');
    }
    public void getSourceBody(){
        string body = '{"HierarchicalRequirement":{"Name":"Rally full Test","Description":"Created my second user story"}}';
        HTTP htt = new HTTP();
        HTTPRequest req = new HTTPRequest(); 
        req.setEndpoint('https://rally1.rallydev.com/slm/webservice/v2.0/defect/create?key='+securityToken);
        req.setHeader('Content-Type', 'application/json');
        req.setMethod('POST');
        req.setBody(body);
        HTTPResponse res = htt.send(req);
        system.debug('response++  '+res.getBody());
    }
}

ERROR : Full authentication is required to access this resource.
Can anyone help me in this please.
i want to get the test2 on clicking in test2 link .how can i get ?User-added image
i want to get the test2 on clicking in test2 link .how can i get ?User-added image
i want to get the test2 on clicking in test2 link .how can i get ?User-added image