Skip to content

Integration API Examples

We provide a full OpenAPI schema here.

You define the API endpoint yourself, based on how you expose the API to the world.

Phaset provides several integration endpoints:

PurposeMethodEndpoint
RecordsPOST/integration/record/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
StandardsPOST/integration/standards/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
EventsPOST/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
BaselinesGET/integration/baselines/{ORG_ID}/{BASELINE_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}

For all timestamps the required format is the Unix timestamp (10 or 13 digits as a string).


The following is a relatively comprehensive example:

Terminal window
curl -X POST -d '{
"spec": {
"name": "Test Component",
"repo": "https://github.com/my_org/test_component",
"description": "A test component",
"lifecycleStage": "development",
"version": "1.0.0",
"kind": "service",
"group": "<random_id>",
"system": "<random_id>",
"domain": "<random_id>",
"dataSensitivity": "internal",
"businessCriticality": "high",
"deploymentModel": "public_cloud",
"sourcingModel": "custom"
},
"baseline": {
"id": "abcd1234"
},
"contacts": [
{
"email": "[email protected]",
"relation": "owner"
}
],
"tags": [
"test",
"example"
],
"slo": [
{
"title": "Availability",
"description": "Service availability",
"type": "availability",
"target": "99.9%",
"period": 30
}
],
"links": [
{
"url": "https://example.com",
"title": "Example",
"icon": "web"
}
],
"api": [
{
"name": "TestAPI",
"schemaPath": "/schema/test.json"
}
],
"dependencies": [
{
"target": "abcde12345",
"description": "A description here",
"criticality": "medium"
}
],
"metadata": {
"createdBy": "test-user"
}
}' https://api.your_company.cloud/integration/record/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldDescription
spec.repoRepository link (e.g., https://github.com/my_org/my_repo)
spec.nameName of the component
FieldTypeOptions/Notes
spec.descriptionStringComponent description (max 1500 characters)
spec.kindEnumservice, api, component, cots, product, external, other
spec.lifecycleStageEnumconcept, planning, development, testing, production, maintenance, deprecated, retired
spec.versionStringVersion string (e.g., “1.0.0”)
spec.groupString8-character group ID
spec.systemString8-character system ID
spec.domainString8-character domain ID
spec.dataSensitivityEnumpublic, internal, secret, other
spec.businessCriticalityEnumcritical, high, medium, low, auxiliary
spec.sourcingModelEnumcots, modified_cots, open_source, custom, outsourced, legacy
spec.deploymentModelEnumonpremises, private_cloud, public_cloud, hybrid_cloud, multi_cloud, edge, saas
FieldTypeConstraintsDescription
contactsArrayMax 3 itemsEach contact requires email, optional relation
baselineObject-Object with id field referencing a Baseline
tagsArrayMax 5, each max 20 charsURL-safe strings
dependenciesArray-Requires target (10-char Record ID), optional description (max 300 chars) and criticality
sloArrayMax 20 itemsRequires title, description, type, target, period (1-365 days)
apiArrayMax 20 itemsRequires name, optional schemaPath (absolute URL)
metadataObjectMax 500 chars per valueCustom string key-value pairs
linksArrayMax 20 itemsRequires url, title, optional icon

The input is a StandardLint result which you get by running StandardLint, an open source Node.js package. For the standards check to run and results to be sent, the Baseline connected to the Record will be fetched and used. If one is not defined, the default Baseline will be used.

Please see the StandardLint documentation for more details.

Before running standards checks, you can retrieve your Baseline configuration:

Terminal window
curl -X GET \
https://api.your_company.cloud/integration/baselines/{ORG_ID}/{BASELINE_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}

This returns a configuration file that can be used with StandardLint.

A call to upload standards results might look like this:

Terminal window
curl -X POST -d '{
"passes": 20,
"warnings": 2,
"failures": 1,
"results": [
{
"message": "Some message",
"name": "ResultName",
"path": "filename.md",
"status": "pass"
}
]
}' https://api.your_company.cloud/integration/standards/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldTypeDescription
passesNumberNumber of passing checks
warningsNumberNumber of warnings
failuresNumberNumber of failures
resultsArrayArray of result objects (see below)

Result Object Fields:

FieldTypeDescription
messageStringDescription of the check result
nameStringName of the check
pathStringPath to the checked file
statusEnumOne of: pass, warning, failure

All event metrics are sent to the same endpoint: POST /integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}

The timestamp can be omitted, in which case the current system time will be used.

Terminal window
curl -X POST -d '{
"event": "change",
"commitSha": "cf1d3df5ea4373e69d8adc3808e9f8ce23b61360",
"timestamp": "1732802071"
}' https://api.your_company.cloud/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldRequiredTypeDescription
eventStringMust be "change"
commitShaStringGit commit SHA
timestamp-StringUnix timestamp (defaults to current time if omitted)

The timestamp can be omitted, in which case the current system time will be used.

Terminal window
curl -X POST -d '{
"event": "deployment",
"commitSha": "cf1d3df5ea4373e69d8adc3808e9f8ce23b61360"
}' https://api.your_company.cloud/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldRequiredTypeDescription
eventStringMust be "deployment"
commitShaStringGit commit SHA

This tracks the issue being opened.

Terminal window
curl -X POST -d '{
"event": "incident-opened",
"id": "abc123",
"createdAt": "1732718640"
}' https://api.your_company.cloud/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldRequiredTypeDescription
eventStringMust be "incident-opened"
idStringIncident identifier
createdAtStringUnix timestamp when incident was created
Terminal window
curl -X POST -d '{
"event": "incident-resolved",
"id": "abc123",
"createdAt": "1732718640",
"resolvedAt": "1732718800"
}' https://api.your_company.cloud/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldRequiredTypeDescription
eventStringMust be "incident-resolved"
idStringIncident identifier
createdAtStringUnix timestamp when incident was created
resolvedAtStringUnix timestamp when incident was resolved
Terminal window
curl -X POST -d '{
"event": "comment"
}' https://api.your_company.cloud/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldRequiredTypeDescription
eventStringMust be "comment"
Terminal window
curl -X POST -d '{
"event": "review-approved",
"createdAt": "1732802071",
"submittedAt": "1733000000"
}' https://api.your_company.cloud/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldRequiredTypeDescription
eventStringMust be "review-approved"
createdAt-StringUnix timestamp when review was created
submittedAt-StringUnix timestamp when review was submitted
Terminal window
curl -X POST -d '{
"event": "review-changes",
"createdAt": "1732802071",
"submittedAt": "1733000000"
}' https://api.your_company.cloud/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldRequiredTypeDescription
eventStringMust be "review-changes"
createdAt-StringUnix timestamp when review was created
submittedAt-StringUnix timestamp when changes were requested
Terminal window
curl -X POST -d '{
"event": "pr-opened",
"additions": 5,
"changedFiles": 3,
"deletions": 2
}' https://api.your_company.cloud/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldRequiredTypeDescription
eventStringMust be "pr-opened"
additions-NumberNumber of lines added
changedFiles-NumberNumber of files changed
deletions-NumberNumber of lines deleted
Terminal window
curl -X POST -d '{
"event": "pr-closed",
"createdAt": "1732802071",
"closedAt": "1732809000"
}' https://api.your_company.cloud/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldRequiredTypeDescription
eventStringMust be "pr-closed"
createdAt-StringUnix timestamp when PR was created
closedAt-StringUnix timestamp when PR was closed
Terminal window
curl -X POST -d '{
"event": "pr-merged",
"createdAt": "1732802071",
"mergedAt": "1732809000"
}' https://api.your_company.cloud/integration/event/{ORG_ID}/{RECORD_ID}/{WEBHOOK_TOKEN}
FieldRequiredTypeDescription
eventStringMust be "pr-merged"
createdAt-StringUnix timestamp when PR was created
mergedAt-StringUnix timestamp when PR was merged