Deploy Registration
Use this endpoint with the POST method to register deploys.
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 followinghttps://app.sleuth.io/
DEPLOYMENT_SLUG
: found in the URL, following the prefixhttps://app.sleuth.io/org_slug/deployments/
Mandatory parameters
Optional parameters
Responses
Name | Type | Comments |
---|---|---|
api_key * | string | Can be found in the Organization Settings -> Details -> Api Key field in your Sleuth org. |
sha * | string | The git SHA of the commit to be registered as a deploy. |
Name | Type | Comments |
---|---|---|
environment | string | The environment to register the deploy against. If not provided Sleuth will use the default environment of the Project. |
date | string | ISO 8601 deployment date and time string |
branch | string | If your code deployment's target environment is mapped to a branch prefix (rather than a specific branch), you must include the deploy’s full branch name as the parameter branch . |
tags | string | A comma-delimited list of tags. Defaults to tags calculated by matching paths defined in your .sleuth/TAGS file.
ℹ # symbol, must be separated with commas, and cannot contain the . symbol. |
ignore_if_duplicate | string | If the value is provided and set to true Sleuth won't return a 400 error if we see a SHA that has already been registered. |
email | string | Email address of author |
links | string | A key/value pair consisting of the link name and the link itself in the following format: mylink=http://my.link If you need to send multiple then send a JSON body POST where the links are a dictionary of values. |
Code | Comments | Response Text |
---|---|---|
200 | Deploy registered successfully. | Success |
400 | Returned if any of the input parameters are invalid, e.g.:
- sha isn't provided
- branch doesn't match the configured branch
- date format isn't valid
- author is not a valid email
- we're unable to validate if the sha exists in the remote system | The response text will indicate the nature of the error:
String of message problem |
401 | API key not valid or the deployment is not in the specified organization | String of message problem |
Make sure you replace the values surrounded by
<
and >
with your own values.1
curl -X POST \
2
'https://app.sleuth.io/api/1/deployments/<ORG_SLUG>/<DEPLOYMENT_SLUG>/register_deploy' \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"sha": "<SHA>",
6
"environment": "<ENVIRONMENT>",
7
"tags": [
8
"#tag1",
9
"#tag2",
10
"#tag3"
11
],
12
"api_key": "<API_KEY>"
13
}'
Please note that tags must start with the
ℹ
#
symbol, must be separated with commas, and cannot contain the .
symbol.1
Invoke-RestMethod -Method POST `
2
-Uri 'https://app.sleuth.io/api/1/deployments/<ORG_SLUG>/<DEPLOYMENT_SLUG>/register-deploy' `
3
-Headers @{
4
'Authorization' = 'apikey <API_KEY>'
5
'Content-Type' = 'application/json'
6
} `
7
-Body '{
8
"environment": "<ENVIRONMENT>",
9
"sha": "<SHA>"
10
}'
1
curl -X POST -v \
2
'https://app.sleuth.io/api/1/deployments/<ORG_SLUG>/<DEPLOYMENT_SLUG>/register_deploy' \
3
-H 'Authorization: apikey <APIKEY>' \
4
-H 'Content-Type: application/json' \
5
-d '{
6
"sha": "<SHA>",
7
"environment": "<ENVIRONMENT>",
8
"ignore_if_duplicate": "true",
9
"commits": [
10
{
11
"revision": "<COMMIT SHA>",
12
"message": "<YOUR COMMIT MESSAGE>",
13
"author": {
14
"name": "Jane",
15
"email": "[email protected]",
16
"username": "[email protected]"
17
},
18
"date": "2022-08-01T00:10:10+00:00",
19
"files": [
20
"/some/path/to/a/file.txt"
21
],
22
"parents": [
23
"<PARENT SHA>"
24
],
25
"url": "http://www.commits/aaa"
26
}
27
],
28
"files": [
29
{
30
"path": "http://www.example.com/some/path.txt",
31
"additions": 3,
32
"deletions": 0,
33
"url": "http://www.example.com"
34
}
35
]
36
}'
Last modified 27d ago