0 Replies Latest reply on Jun 21, 2018 3:23 AM by Czernobog

    vRA 7.4 - Network Profile list\update REST API calls - works with curl, not with vRO REST Plugin

    Czernobog Hot Shot

      I want to extend an IP range in one of the network profiles. This does not seem to be possible using the GUI, since the edit option is greyed out:

      The network range extension can be done using REST. In the first step, I have built a small vRO workflow that would first create a new token which is passed to the next step, where an API call takes place, to list all network profiles. This is documented here:


      Now I have stumpled upon a few problems:

      1. The URL listed is not complete - the above documentation lists GET /api/network/profiles as the host extension, but it should be /iaas-proxy-provider/api/network/profiles, toherwise the request ends with an error 404. This is done correctly in the online documentation: Get a Network Profile List Since the iaas-proxy-provider API is deprecated - what should be used instead?
      2. When using curl to execute the GET call, the call ends with an error 401. This is because there is a space between "Authorization: " and "Bearer $token". After the space character is ommited, "Authorization:Bearer $token", the call works.
      3. I have tried to implement the above to be executed in vRO. First a workflow runs to extract the token. After that the token is passed to another workflow, that would generate a list of the network profiles, by executing the GET call. For that I use the "Invoke a REST operation" workflow, modified to add the authorization token, like here:

           // Add authorization header

           request.setHeader("Authorization:Bearer ", token);

      Each time I run it though, I get an error 401. Is there another way to pass the token in a workflow? I could try to build a rest client with var restClient = cafeHost.createRestClient(endpoint), but what would be the endpoint here?

      Is the "edit network range by api" approach valid anyway? I fear there is a risk, when executing the PUT call to edit the range, the already assigned IPs will become unallocated.