CA Service Management

 View Only
  • 1.  Query Attributes Using REST

    Posted Apr 07, 2017 02:41 PM

    I'm wondering how to specify a list of attributes to retrieve from an object using the GET method. 

    For example in soap you could use the doSelect method and it would return you a list all the attributes for a CI or a contact.

    I can use GET to with a WC to retrieve my contact record, but i can't retrieve my userid, dept, or other attributes.

    How do you obtain a list of one or many attributes for an object with REST?



  • 2.  Re: Query Attributes Using REST
    Best Answer

    Broadcom Employee
    Posted Apr 07, 2017 02:56 PM

    Elwynn, installed example SampleCRUDOperations.java has "

    String endpointGET = baseURI + "/in";

    GetMethod get = new GetMethod(endpointGET);
    get.addRequestHeader("X-AccessKey", accessKey);
    get.addRequestHeader("Accept" , "application/xml");
    get.addRequestHeader("X-Obj-Attrs" , "ref_num, status, summary");"

    so modify to "

    String endpointGET = baseURI + "/cnt";

    GetMethod get = new GetMethod(endpointGET);
    get.addRequestHeader("X-AccessKey", accessKey);
    get.addRequestHeader("Accept" , "application/xml");
    get.addRequestHeader("X-Obj-Attrs" , "userid, dept, maybe-more...");"

    is this what you looked for? Thanks _Chi



  • 3.  Re: Query Attributes Using REST

    Posted Apr 07, 2017 03:21 PM

    Chi,

     

    Yes, the X-Obj-Attrs Header is what i'm missing! 

     

    Thank you!

    Elwynn.