Create a contract - Gable Docs
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create a contract
POST /v0/contract
curl --request POST \
--url https://demo-api.gable.ai/v0/contract \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractSpec": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"doc": "<string>",
"name": "<string>",
"namespace": "<string>",
"owner": "jsmith@example.com",
"schema": [
{
"type": "struct",
"name": "<string>",
"fields": [
{
"type": "struct",
"name": "<string>",
"fields": "<array",
"alias": "<string>",
"doc": "<string>",
"logical": "<string>",
"optional": true
}
],
"alias": "<string>",
"doc": "<string>",
"logical": "<string>",
"optional": true,
"constraints": {}
}
],
"dataAssetResourceName": "<string>",
"dataAssetResourceNameList": ["<string>"],
"restrictPii": true
},
"parentRowId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": "<string>",
"gitHash": "<string>",
"gitRepo": "<string>",
"gitUser": "<string>",
"reviewers": ["<string>"],
"filePath": "<string>",
"mergedAt": "2023-11-07T05:31:56Z",
"lastEditorUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lastEditorEmail": "<string>",
"lastEditorFirstName": "<string>",
"lastEditorLastName": "<string>",
"lastEditorGithubHandle": "<string>"
}
'
import requests
url = "https://demo-api.gable.ai/v0/contract"
payload = {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractSpec": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"doc": "<string>",
"name": "<string>",
"namespace": "<string>",
"owner": "jsmith@example.com",
"schema": [
{
"type": "struct",
"name": "<string>",
"fields": [
{
"type": "struct",
"name": "<string>",
"fields": "<array>",
"alias": "<string>",
"doc": "<string>",
"logical": "<string>",
"optional": true
}
],
"alias": "<string>",
"doc": "<string>",
"logical": "<string>",
"optional": true,
"constraints": {}
}
],
"dataAssetResourceName": "<string>",
"dataAssetResourceNameList": ["<string>"],
"restrictPii": true
},
"parentRowId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": "<string>",
"gitHash": "<string>",
"gitRepo": "<string>",
"gitUser": "<string>",
"reviewers": ["<string>"],
"filePath": "<string>",
"mergedAt": "2023-11-07T05:31:56Z",
"lastEditorUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lastEditorEmail": "<string>",
"lastEditorFirstName": "<string>",
"lastEditorLastName": "<string>",
"lastEditorGithubHandle": "<string>"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
contractSpec: {
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
doc: '<string>',
name: '<string>',
namespace: '<string>',
owner: 'jsmith@example.com',
schema: [{
type: 'struct',
name: '<string>',
fields: [{
type: 'struct',
name: '<string>',
fields: '<array>',
alias: '<string>',
doc: '<string>',
logical: '<string>',
optional: true
}],
alias: '<string>',
doc: '<string>',
logical: '<string>',
optional: true,
constraints: {}
}],
dataAssetResourceName: '<string>',
dataAssetResourceNameList: ['<string>'],
restrictPii: true
},
parentRowId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
version: '<string>',
gitHash: '<string>',
gitRepo: '<string>',
gitUser: '<string>',
reviewers: ['<string>'],
filePath: '<string>',
mergedAt: '2023-11-07T05:31:56Z',
lastEditorUserId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
lastEditorEmail: '<string>',
lastEditorFirstName: '<string>',
lastEditorLastName: '<string>',
lastEditorGithubHandle: '<string>'
})
};
fetch('https://demo-api.gable.ai/v0/contract', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
Response example:
{
"message": "<string>",
"contractIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
}