Get the Details of a VM Using the REST API

You can use the REST API to retrieve all the details of a VM.

  1. To send REST API calls to Compute Classic, you need a valid authentication token. If you obtained a token less than 30 minutes ago, then you can use that token. Otherwise, get a new token as described in Get an Authentication Token.
  2. Send the following REST API request:

    Syntax:

    curl -X GET \
         -H "Cookie: $COMPUTE_COOKIE" \
         -H "Accept: application/oracle-compute-v3+json" \
         {restEndpointURL}/instance/{userName}/{instanceName}

    If you don't know the REST endpoint URL and user name, follow the instructions in Prepare to Use the REST API.

  3. Example:
    curl -X GET \
         -H "Cookie: $COMPUTE_COOKIE" \
         -H "Accept: application/oracle-compute-v3+json" \
         https://api-z999.compute.us0.oraclecloud.com/instance/Compute-575260584/jack.jones@example.com/dev1/f653a677-b566-4f92-8e93-71d47b364119

    The response body contains all the details of the specified instance, in JSON format.