To create an integration with GitHub, you make a POST request. The request body includes properties specific to GitHub.

Prerequisites

Procedure

  1. Assign variables for GitHub.
    private_key='<your_GitHub_personal_access_token>'
  2. Submit a request to create a GitHub integration.
    curl -X POST \
      "$url/iaas/api/integrations?apiVersion=$api_version" \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "integrationType":"com.github.saas",
        "name":"<your_github_integration>",
        "privateKey":"'$private_key'",
        "integrationProperties":{
          "url":"https://api.github.com"
        },
      }' | jq "."
    The response includes a selfLink.
    {
      "progress": 0,
      "status": "INPROGRESS",
      "name": "Integration creation/update",
      "id": "example-selfLink-alphanumeric-string",
      "selfLink": "/iaas/api/request-tracker/example-selfLink-alphanumeric-string"
    }
  3. Assign the selfLink variable.
    selfLink_id='example-selfLink-alphanumeric-string'
  4. Use the selfLink variable to track the request.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/request-tracker/$selfLink_id?apiVersion=$api_version" | jq "."
    When the request completes successfully, the response includes a resource with the integration ID.
    {
      "progress": 100,
      "status": "FINISHED",
      "resources": [
          "/iaas/api/integrations/example-integration-id-string"
      ],
      "name": "Integration creation/update",
      "id": "example-selfLink-alphanumeric-string",
      "selfLink": "/iaas/api/request-tracker/example-selfLink-alphanumeric-string"
    }
  5. Assign the integration ID variable.
    integration_id='example-integration-alphanumeric-string'
  6. Use the integration ID variable to list the integration.
    curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/integrations/$integration_id?apiVersion=$api_version" | jq "."
  7. Examine the response and verify that the name and ID of the integration that you created is listed.

Example: Create a GitHub integration

Assign the required variables.

$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
$ private_key='8bc9401b5d28f4ec126929af0dc4e99dd0792b0f'

Create the integration.

$ curl -X POST \
  "$url/iaas/api/integrations?apiVersion=$api_version" \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $access_token" \
  -d '{
    "integrationType":"com.github.saas",
    "name":"Git integration example",
    "privateKey":"'$private_key'",
    "integrationProperties":{
      "url":"https://api.github.com"
    },
  }' | jq "."

The response includes a selfLink.

{
  "progress": 0,
  "status": "INPROGRESS",
  "name": "Integration creation/update",
  "id": "a0c5eb3a-9ffa-4bfb-b63b-c77510bcc597",
  "selfLink": "/iaas/api/request-tracker/a0c5eb3a-9ffa-4bfb-b63b-c77510bcc597"
}

Assign the selfLink variable

selfLink_id='a0c5eb3a-9ffa-4bfb-b63b-c77510bcc597'

Use the selfLink variable to track the request.

curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/request-tracker/$selfLink_id?apiVersion=$api_version" | jq "."

When the request completes successfully, the response includes a resource with the integration ID.

{
  "progress": 100,
  "status": "FINISHED",
  "resources": [
      "/iaas/api/integrations/e5dda941-bb17-4f19bd15-7db0b8eab88c"
  ],
  "name": "Integration creation/update",
  "id": "a0c5eb3a-9ffa-4bfb-b63b-c77510bcc597",
  "selfLink": "/iaas/api/request-tracker/a0c5eb3a-9ffa-4bfb-b63b-c77510bcc597"
}

Assign the integration ID variable

integration_id='e5dda941-bb17-4f19bd15-7db0b8eab88c'

Use the integration ID variable to list the integration.

curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/integrations/$integration_id?apiVersion=$api_version" | jq "."

When the request completes successfully, a snippet of the response shows integration details.

...
    {
       "integrationType": "com.github.saas",
       "integrationProperties": (
          "url": "https://api.github.com"
       },
       "name":"Git integration example",
       "id: "e5dda941-bb17-4f19bd15-7db0b8eab88c"
       "createdAt":"2022-04-02"
       "updatedAt": "2022-04-02"
       "orgId": "ce811934-ea1a-4f53-6bec-4656ca7d126",
       "_links": {
          "self": {
             "href": "/iaas/api/integrations/e5dda941-bb17-4f19bd15-7db0b8eab88c"
          }
       }
    }
...