Adding Intelligent Environment Services to your Application

Before you begin

You must update your OAuth2 client to use your service instance before you perform this task.

About this task

This task is two parts:

Procedure

Getting a Bearer Token from UAA

  1. In a REST client, Authorization tab:
    1. Choose the GET method.
    2. Enter the URI of your UAA instance, such as: https://<your_uaa_instance_uri>/oauth/token?grant_type=client_credentials
      Note: Make sure you include grant_type=client_credentials in your URI.
    3. Add the following information as shown in the graphic below the table.
      Type Select Basic Auth from the drop-down list.
      Username Enter the client ID that you created in Updating the OAuth2 Client, such as traffic_test2.
      Password Enter the client secret that you created in Updating the OAuth2 Client, such as traffic2.

      Figure: REST Client Authorization Tab

    4. Click Send.
    5. Select the access_token that is returned and copy it to your clipboard. This is the token that you need in Step 2c below, for Authorization.

      Figure: REST Client Bearer Access Token

    6. Verify that the scope given is the same as used in the VCAP_SERVICES environment variable.

Ensuring client apps can access IE data

  1. In a REST client:
    1. Choose the POST method.
    2. Enter the URI of your service instance, from the VCAP_SERVICES environment variable.
    3. Add the following HTTP headers per the graphic below the table:
      Content-Type Enter the value application/json.
      Authorization Enter the token you receive from UAA in the form of Bearer <token from trusted issuer> in Step 1e above.
      Predix-Zone-Id Enter the ID required to make REST calls, using the instanceId value specified in the VCAP-SERVICES environment variable.

      Figure: Example of HTTP Headers

    4. Enter well-formed JSON in the body of your request.

      Figure: Example of Well-formed JSON