VMware Cloud Foundation

 View Only
  • 1.  How to get auth token for VCF 9.0 Operations (Operations and Fleet Management API)

    Posted 2 days ago

    I'm trying to use the Swagger interface for both of these APIs:

    1) VMware Cloud Foundation Operations API (https://myVcf9Operations/suite-api/doc/swagger-ui.html

    2) VCF Operations Fleet Management API - 9.0.0.0 (https://myVcf9Operations/api/swagger-ui/index.html)

    ...using the information here:

    Acquire Token

    VMware Cloud Foundation Operations API | VCF Operations API

    Using Git Bash I get this:

    $ curl -X POST -H 'Content-Type: application/json' -d '{"password:"myPassword","username:"admin"}' --insecure https://myVcf9Operations/suite-api/api/auth/token/acquire
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   292    0   243  100    49   2448    493 --:--:-- --:--:-- --:--:--  3173{"type":"Error","message":"Invalid input format. character ('V'","inputBodyLocation":{"lineNumber":1,"columnNumber":14},"moreInformation":[{"name":"api-uri","value":"/suite-api/api/auth/token/acquire"}],"httpStatusCode":400,"apiErrorCode":400}
    

    I'm using the above syntax instead of the sample on the web page which is:

    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"password:"string","username:"string"}' https://{api_host}/suite-api/api/auth/token/acquire

    ... but there is no explanation for 'Authorization: <value>'.

    Q1: Is anyone able to acquire an auth token?

    Q2: If so, how did you do it?



  • 2.  RE: How to get auth token for VCF 9.0 Operations (Operations and Fleet Management API)

    Broadcom Employee
    Posted 17 hours ago

    What you should get back from the initial request is an API key.  

    It looks like some quoting syntax in the command (maybe also the example?). 

    The format of the object that you need for the initial call looks like this:

    {
      "username": "admin",
      "authSource": "LOCAL",
      "password": "your_password"
    }


    So, this worked for me 

    $ curl -k -X POST -H 'Content-Type: application/json' -d '{"authSource":"LOCAL","password":"MY_ADMIN_PASSWORD","username":"admin"}' https://MY_OPS_FQDN/suite-api/api/auth/token/acquire
    
    {"token":"3f56e42f-941d-44e6-941d-47503122dbba::3fd04fa9-4ebd-456b-8601-b5e6bb462f35","validity":1753475307458,"expiresAt":"Friday, July 25, 2025 at 8:28:27 PM Coordinated Universal Time","roles":[]}


    I hope that helps. 





    ------------------------------
    --
    Advanced Services Architect | VCF Division
    ------------------------------