REST API questions

Burke
2014-03-31
2015-08-06
  • Burke
    Burke
    2014-03-31

    Hello,
    I've written a set of VMware vCenter Orchestrator workflows https://communities.vmware.com/docs/DOC-25437 that utilize the HTTP-REST plug-in to make calls to iTOP. VMware has actually used these in numerous trainings to highlight the ease of integration with products that provide an API.

    In an effort to improve reusability of the workflows, I need to know the following and hope someone here can assist:
    1) Is it possible to get the username and password passed to the API via basic authentication instead of providing credentials on the endpoint url?
    2) Is it possible to query the API to get a list of known classes? I realize the "Data Model" section under the Admin Tools section of the UI provides this info, but I need to get it via the API.
    3) Has any consideration been given to changing the REST API to take the json data as the BODY of a REST GET/POST operation instead of passing everything on the endpoint url?

    Thanks,
    Burke

     
  • Derek
    Derek
    2015-05-18

    This has not seemed to be the case for any of your questions. I've been having the same ones. Passing auth into the URL? Passing the JSON into the URL as opposed to the BODY? I have no idea if they are working to solve these issues.

     
  • Hi,

    1) Yes, it's possible using HTTP basic authentication like : "Authorization: Basic Zm9vOmJhcg==". Note that even though your credentials are encoded, they are not encrypted! It is very easy to retrieve the username and password from a basic authentication. Do not use this authentication scheme on plain HTTP, but only through SSL/TLS.

    2) No, it's not possible. You can only returns the list of all possible operations with json_data={"operation": "list_operations"}.

    3) Yes, it's possible

    HEADER

    POST / HTTPS/1.1
    Host: localhost/itop/webservices/rest.php?version=1.1
    Authorization: Basic Zm9vOmJhcg==
    Accept: application/json
    Content-Type: application/x-www-form-urlencoded
    

    BODY

    json_data={
       "operation": "core/get",
       "class": "Person",
       "key": "SELECT Person WHERE email LIKE 'test@test.com'",
       "output_fields": "friendlyname, email"
    }
    

    RESPONSE

    {"objects":{"Person::1":{"code":0,"message":"","class":"Person","key":"1","fields":{"friendlyname":"MyFirstname MyLastname","email":"test@test.com"}}},"code":0,"message":"Found: 1"}
    

    Regards,

     
  • Thiago Arcanjo
    Thiago Arcanjo
    2015-08-06

    You want integrate VMware with iTop or iTop with VMware?
    The data go to what DB? iTop DB or VMware DB?