import requests
url = "https://platform.ankra.app/api/v1/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/api/v1/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/api/v1/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
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/api/v1/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/api/v1/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/api/v1/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
Query Parameters
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, and existing_ci (the CI the repository already runs - presence, each definition's tests, image builds, pushes, tag scheme, triggers and runner labels, whether it is observed to start - and the adoption plan: adopt its publish, keep it for tests, or propose Ankra Pipelines).