Set up a GitHub connection using the API
Last updated
Last updated
More information
Snyk privacy policy© 2024 Snyk Limited | All product and company names and logos are trademarks of their respective owners.
This page provides an example of using the Snyk API to set up a GitHub connection with the Universal Broker. Repeat connecting your Organization for as many integrations as needed.
Using the snyk-broker-config
command is recommended for an easier experience. The API allows for automation and more control, and also requires a clear understanding of Broker deployments, credentials, and connections.
In any of the calls that follow, replace api.snyk.io
with your regional equivalent if necessary, for example, api.eu.snyk.io
.
Install the Universal Broker App at the Organization level. Group-level installation is not supported. Use the endpoint to Install a Snyk App for this Organization.
This returns the DEPLOYMENT_ID (data.id), for example:
At this point, you can start running the Broker client.
Target your desired environment with the usual -e BROKER_SERVER_URL=https://broker.REGION.snyk.io \
if needed.
When the command is running, you should get the following message in the output:
This returns the credential reference id (data. id), for example:
You can create a maximum of ten credentials in one call by adding more objects in attributes. These objects can be of different types.
This returns a Connection ID (data.id), as shown in the example. Note that this call returns the credential reference directly, ready for use, instead of the cred reference UUID.
If your credential reference is missing, you will get the following message: