import requests
url = "https://platform.ankra.app/org/applications/{application_id}/app-contract"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/org/applications/{application_id}/app-contract', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/org/applications/{application_id}/app-contract \
--header 'Authorization: Bearer <token>'{
"application_id": "<string>",
"commit_sha": "<string>",
"schema_version": "<string>",
"analysed_at": "2023-11-07T05:31:56Z",
"contract": {}
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Get an application's App Contract (browser session)
The App Contract the setup run extracted from an analysed commit of the application (ankra-bjkszh.1): its components, listen port and IP family, environment variables marked required, optional or secret with the file and line that reads each, the external services it talks to, its migrations, build inputs, health routes and exposure. The latest analysed commit by default; commit_sha names one. Every field but application_id is null when no analysis has extracted a contract yet. Requires applications.read.
import requests
url = "https://platform.ankra.app/org/applications/{application_id}/app-contract"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/org/applications/{application_id}/app-contract', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/org/applications/{application_id}/app-contract \
--header 'Authorization: Bearer <token>'{
"application_id": "<string>",
"commit_sha": "<string>",
"schema_version": "<string>",
"analysed_at": "2023-11-07T05:31:56Z",
"contract": {}
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
The analysed commit whose contract to return; without it, the most recently analysed one.
^[0-9a-f]{7,64}$Response
The stored contract, or nulls when none has been extracted
One analysed commit's App Contract (schema ankra.app-contract/v1, enginekit/appcontract). Null fields mean no contract has been extracted for the application yet, not that the repository declares nothing.
The contract document: source, completeness, components, network, environment, dependencies, migrations, build_inputs, health, exposure.