Deploy Registration

Use this endpoint with the POST method to register deploys.

Path

ENDPOINT

https://app.sleuth.io/api/1/deployments/ORG_SLUG/DEPLOYMENT_SLUG/register_deploy

The endpoint path takes 2 slugs which direct the deploy to the correct code deployment:

  • ORG_SLUG: found in the URL of your Sleuth org, immediately following https://app.sleuth.io/

  • DEPLOYMENT_SLUG: found in the URL, following the prefix https://app.sleuth.io/org_slug/deployments/

Authentication

Each request must contain an Authorization header including an Access Token. We recommend using an Access Token with limited scope which can only be used for deploy registration.

You can manage your org's tokens it in the Organization Settings -> Access Tokens page.

Parameters

NameTypeComments

sha*

string

The git SHA of the commit to be registered as a deploy.

Examples

Make sure you replace the values surrounded by< and >with your own values.

cURL
curl -X POST \
'https://app.sleuth.io/api/1/deployments/<ORG_SLUG>/<DEPLOYMENT_SLUG>/register_deploy' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
  "sha": "<SHA>",
  "environment": "<ENVIRONMENT>"
}'
cURL with optional Tags
curl -X POST \
'https://app.sleuth.io/api/1/deployments/<ORG_SLUG>/<DEPLOYMENT_SLUG>/register_deploy' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
  "sha": "<SHA>",
  "environment": "<ENVIRONMENT>",
  "tags": [
    "#tag1",
    "#tag2",
    "#tag3"
    ]
  }'

ℹ️ Please note that tags must start with the # symbol, must be separated with commas, and cannot contain the . symbol.

PowerShell
Invoke-RestMethod -Method POST `
-Uri 'https://app.sleuth.io/api/1/deployments/<ORG_SLUG>/<DEPLOYMENT_SLUG>/register-deploy' `
-Headers @{
      'Authorization' = 'Bearer <ACCESS_TOKEN>'
      'Content-Type' = 'application/json'
} `
-Body '{
      "environment": "<ENVIRONMENT>",
      "sha": "<SHA>" 
 }'
cURL using Custom Git
curl -X POST -v \
'https://app.sleuth.io/api/1/deployments/<ORG_SLUG>/<DEPLOYMENT_SLUG>/register_deploy' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
    "sha": "<SHA>",
    "environment": "<ENVIRONMENT>",
    "ignore_if_duplicate": "true",
    "commits": [
      {
        "revision": "<COMMIT SHA>",
        "message": "<YOUR COMMIT MESSAGE>",
        "author": {
          "name": "Jane",
          "email": "jane@email.com",
          "username": "jane@email.com"
        },
        "date": "2022-08-01T00:10:10+00:00",
        "files": [
          "/some/path/to/a/file.txt"
        ],
        "parents": [
          "<PARENT SHA>"
        ],
        "url": "http://www.commits/aaa"
      }
    ],
    "files": [
      {
        "path": "http://www.example.com/some/path.txt",
        "additions": 3,
        "deletions": 0,
        "url": "http://www.example.com"
      }
    ]
  }'

Last updated