A Snippet object has the following properties:
id
: string - The unique identifier of a snippetA Snippet Version object has the following properties:
id
: string - The unique identifier of a snippet versionCreates a new snippet.
POST /api/v2/snippet
Arguments:
name
- string : The name for the inital version of the snippetdescription
- string : The description for the inital version of the snippettext
- string : The text for the inital version of the snippetcreatedByPersonId
- string : The optional created by person for the inital version of the snippetisLocked
- boolean : Whether the snippet is lockedpublicAccessLevel
- string : The public access level of this snippet for non-owners, either ’none’, ‘read_only’, ‘read_write’, or ‘manage’owner
- string : The type of owner for the snippet, either ’none’, ‘role’, or ‘person’ownerPersonId
- string : The optional owner person of the snippet or null (must be populated for owner type ‘person’)ownerRoleId
- string : The optional owner role of the snippet or null (must be populated for owner type ‘role’)Response object:
id
- string : The unique identifier of the snippetactiveVersion
- object : The active version of this snippet
id
- string : The unique identifier of the active snippet versionname
- string : The name of the active snippet versiondescription
- string : The description of the active snippet versiontext
- string : The text of the active snippet versionisLocked
- boolean : Whether the snippet is lockedpublicAccessLevel
- string : The public access level of this snippet for non-owners, either ’none’, ‘read_only’, ‘read_write’, or ‘manage’ownerPerson
- object : The person that owns this snippet or null
id
- string : The unique identifier of the personusername
- string : The username the personemail
- string : The email of the personname
- string : The display of the personownerRole
- object : The role that owns this snippet or null
id
- string : The unique identifier of the personname
- string : The display of the personcreatedAt
- timestamp : When the snippet was createdupdatedAt
- timestamp : When the snippet was last updatedExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X POST \
"${JACKDB_API_URL}/snippet" \
-d "name=sample&description=A sample query&text=SELECT 1&publicAccessLevel=none&owner=person&ownerPersonId=PkNJRdbtfjFsL6CaC"
Example response:
{
"id": "ScRthIsjOBol2ULt",
"activeVersion": {
"id": "243f5c00-cbc8-4857-b1c6-e117903ec854",
"name": "sample",
"description": "A sample query",
"text": "SELECT 1"
},
"isLocked": false,
"publicAccessLevel": "none",
"ownerPerson": {
"id": "PkNJRdbtfjFsL6CaC",
"username": "abrewer",
"email": "angelique.brewer@example.com",
"name": "Angelique Brewer"
},
"ownerRole": null,
"createdAt": "2019-08-14T16:16:10.448Z",
"updatedAt": "2019-08-14T16:16:10.448Z"
}
Create a new version of an existing snippet.
POST /api/v2/snippet/:snippet/version
Arguments:
snippet
- string : The identifier of the snippetname
- string : The name for the inital version of the snippetdescription
- string : The description for the inital version of the snippettext
- string : The text for the inital version of the snippetcreatedByPersonId
- string : The optional created by person for the version of the snippetResponse object:
id
- string : The identifier of the snippet versionsnippetId
- string : The identifier of the snippetname
- string : The name of the snippet versiondescription
- string : The description of the snippet versiontext
- string : The text of the snippet versioncreatedAt
- timestamp : When the snippet version was createdcreatedBy
- object : The person that created this snippet version or null
id
- string : The unique identifier of the personusername
- string : The username the personemail
- string : The email of the personname
- string : The display of the personExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X POST \
"${JACKDB_API_URL}/snippet/SQxfo8qICrZG1ZT7/version" \
-d "name=sample&description=A sample query&text=SELECT 2&createdByPersonId=PkNJRdbtfjFsL6CaC"
Example response:
{
"id": "4170855d-802e-4347-8d8d-1183ef9a05c5",
"snippetId": "SQxfo8qICrZG1ZT7",
"name": "sample",
"description": "A sample query",
"text": "SELECT 2",
"createdAt": "2019-08-14T20:37:30.795Z",
"createdBy": {
"id": "PkNJRdbtfjFsL6CaC",
"username": "abrewer",
"email": "angelique.brewer@example.com",
"name": "Angelique Brewer"
}
}
Deletes an existing snippet.
DELETE /api/v2/snippet/:snippet
Arguments:
snippet
- string : The identifier of the snippet to be deletedResponse object:
This method returns an object with no properties.
Example request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X DELETE \
"${JACKDB_API_URL}/snippet/ScRthIsjOBol2ULt"
Example response:
{}
List all versions of an existing snippet.
GET /api/v2/snippet/:snippet/version
Arguments:
snippet
- string : The identifier of the snippetResponse object:
id
- string : The identifier of the snippet versionsnippetId
- string : The identifier of the snippetname
- string : The name of the snippet versiondescription
- string : The description of the snippet versiontext
- string : The text of the snippet versioncreatedAt
- timestamp : When the snippet version was createdcreatedBy
- object : The person that created this snippet version or null
id
- string : The unique identifier of the personusername
- string : The username the personemail
- string : The email of the personname
- string : The display of the persondataSource
- object : The data source for this snippet version or null
id
- string : The unique identifier of the data sourcename
- string : The name of the data sourceconfigUri
- string : The connection URI of the data sourceExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
"${JACKDB_API_URL}/snippet/SiK8jWTiKBji4esW/version"
Example response:
[
{
"id": "9b36bbe7-fdba-4c49-bd65-03cc0b81541a",
"snippetId": "SiK8jWTiKBji4esW",
"name": "sample",
"description": "A sample query",
"text": "SELECT 1",
"createdAt": "2019-08-14T16:16:03.108Z",
"createdBy": null
"dataSource": null
},
{
"id": "e095b986-a2df-42d2-a85e-268a2c458238",
"snippetId": "SiK8jWTiKBji4esW",
"name": "sample",
"description": "A sample query",
"text": "SELECT 2",
"createdAt": "2019-08-14T21:01:36.947Z",
"createdBy": {
"id": "PkNJRdbtfjFsL6CaC",
"username": "abrewer",
"email": "angelique.brewer@example.com",
"name": "Angelique Brewer"
},
"dataSource": {
"id": "DUGC6IqGQ4DX00Lt0",
"name": "General Ledger",
"configUri": "postgresql://gl@db.example.com:5432/gl"
}
}
]
Returns a list of snippets.
GET /api/v2/snippet
Arguments:
This method has no additional arguments.
Response object:
id
- string : The unique identifier of the snippetactiveVersion
- object : The active version of this snippet
id
- string : The unique identifier of the active snippet versionname
- string : The name of the active snippet versiondescription
- string : The description of the active snippet versiontext
- string : The text of the active snippet versiondataSource
- object : The data source for this snippet version or null
id
- string : The unique identifier of the data sourcename
- string : The name of the data sourceconfigUri
- string : The connection URI of the data sourceisLocked
- boolean : Whether the snippet is lockedpublicAccessLevel
- string : The public access level of this snippet for non-owners, either ’none’, ‘read_only’, ‘read_write’, or ‘manage’ownerPerson
- object : The person that owns this snippet or null
id
- string : The unique identifier of the personusername
- string : The username the personemail
- string : The email of the personname
- string : The display of the personownerRole
- object : The role that owns this snippet or null
id
- string : The unique identifier of the personname
- string : The display of the personcreatedAt
- timestamp : When the snippet was createdupdatedAt
- timestamp : When the snippet was last updatedExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
"${JACKDB_API_URL}/snippet"
Example response:
[
{
"id": "SzKWkg28ZEVV96Tp",
"activeVersion": {
"id": "1fb93ebe-f3ce-4958-bb03-2bb05f0d7355",
"name": "Test Snippet",
"description": "Sample description goes here",
"text": "SELECT 1",
"dataSource:" null
},
"isLocked": false,
"publicAccessLevel": "manage",
"ownerPerson": null,
"ownerRole": null,
"createdAt": "2019-08-10T21:34:59.542Z",
"updatedAt": "2019-08-10T21:34:59.542Z"
},
{
"id": "SmGRTOi51vUKNPYz",
"activeVersion": {
"id": "ddaf6347-1f44-4cd5-a1bf-2f577dda687d",
"name": "Another sample snippet",
"description": "A basic example of a snippet.",
"text": "SELECT *\nFROM information_schema.columns",
"dataSource": {
"id": "DUGC6IqGQ4DX00Lt0",
"name": "General Ledger",
"configUri": "postgresql://gl@db.example.com:5432/gl"
}
},
"isLocked": true,
"publicAccessLevel": "read_write",
"ownerPerson": null,
"ownerRole": {
"id": "RXNLDrYxE47fNxMx",
"name": "Marketing"
},
"createdAt": "2019-06-22T13:19:15.176Z",
"updatedAt": "2019-07-26T17:20:21.464Z"
}
]
Locks an existing snippet.
PUT /api/v2/snippet/:snippet/lock
Arguments:
snippet
- string : The identifier of the snippet to lockResponse object:
This method returns an object with no properties.
Example request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X PUT \
"${JACKDB_API_URL}/snippet/SiK8jWTiKBji4esW/lock"
Example response:
{}
Retrieves the details of an existing snippet.
GET /api/v2/snippet/:snippet
Arguments:
Response object:
id
- string : The unique identifier of the snippetactiveVersion
- object : The active version of this snippet
id
- string : The unique identifier of the active snippet versionname
- string : The name of the active snippet versiondescription
- string : The description of the active snippet versiontext
- string : The text of the active snippet versionisLocked
- boolean : Whether the snippet is lockedpublicAccessLevel
- string : The public access level of this snippet for non-owners, either ’none’, ‘read_only’, ‘read_write’, or ‘manage’ownerPerson
- object : The person that owns this snippet or null
id
- string : The unique identifier of the personusername
- string : The username the personemail
- string : The email of the personname
- string : The display of the personownerRole
- object : The role that owns this snippet or null
id
- string : The unique identifier of the personname
- string : The display of the personcreatedAt
- timestamp : When the snippet was createdupdatedAt
- timestamp : When the snippet was last updatedExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
"${JACKDB_API_URL}/snippet/ScRthIsjOBol2ULt"
Example response:
{
"id": "ScRthIsjOBol2ULt",
"activeVersion": {
"id": "243f5c00-cbc8-4857-b1c6-e117903ec854",
"name": "sample",
"description": "A sample query",
"text": "SELECT 1"
},
"isLocked": false,
"publicAccessLevel": "none",
"ownerPerson": {
"id": "PkNJRdbtfjFsL6CaC",
"username": "abrewer",
"email": "angelique.brewer@example.com",
"name": "Angelique Brewer"
},
"ownerRole": null,
"createdAt": "2019-08-14T16:16:10.448Z",
"updatedAt": "2019-08-14T16:16:10.448Z"
}
Retrieve a version of an existing snippet.
GET /api/v2/snippet/:snippet/version/:snippetVersion
Arguments:
snippet
- string : The identifier of the snippetsnippetVersion
- string : The identifier of the snippet version to retrieveResponse object:
id
- string : The identifier of the snippet versionsnippetId
- string : The identifier of the snippetname
- string : The name of the snippet versiondescription
- string : The description of the snippet versiontext
- string : The text of the snippet versioncreatedAt
- timestamp : When the snippet version was createdcreatedBy
- object : The person that created this snippet version or null
id
- string : The unique identifier of the personusername
- string : The username the personemail
- string : The email of the personname
- string : The display of the personExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
"${JACKDB_API_URL}/snippet/SiK8jWTiKBji4esW/version/e095b986-a2df-42d2-a85e-268a2c458238"
Example response:
{
"id": "e095b986-a2df-42d2-a85e-268a2c458238",
"snippetId": "SiK8jWTiKBji4esW",
"name": "sample",
"description": "A sample query",
"text": "SELECT 2",
"createdAt": "2019-08-14T21:01:36.947Z",
"createdBy": {
"id": "PkNJRdbtfjFsL6CaC",
"username": "abrewer",
"email": "angelique.brewer@example.com",
"name": "Angelique Brewer"
}
}
Unlocks an existing snippet.
PUT /api/v2/snippet/:snippet/unlock
Arguments:
snippet
- string : The identifier of the snippet to unlockResponse object:
This method returns an object with no properties.
Example request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X PUT \
"${JACKDB_API_URL}/snippet/SiK8jWTiKBji4esW/unlock"
Example response:
{}
Updates the access permissions of an existing snippet.
POST /api/v2/snippet/:snippet
Arguments:
snippet
- string : The identifier of the snippet to be updatedpublicAccessLevel
- string : The public access level of this snippet. One of: ’none’, ‘read_only’, ‘read_write’, or ‘manage’owner
- string : The owner type of this snippet. One of: ’none’, ‘person’, or ‘role’ownerPerson
- string : The unique identifier of the person that owns this snippet, if the owner
is set to ‘person’ownerRole
- string : The unique identifier of the role that owns this snippet, if the owner
is set to ‘role’Response object:
This method returns an object with no properties.
Example request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X POST \
-d "owner=person&publicAccessLevel=none&ownerPersonId=PkNJRdbtfjFsL6CaC" \
"${JACKDB_API_URL}/snippet/SzKWkg28ZEVV96Tp"
Example response:
{}
Update the active version of an existing snippet.
POST /api/v2/snippet/:snippet/version/:snippetVersion
Arguments:
snippet
- string : The identifier of the snippetsnippetVersion
- string : The identifier of the snippet version to set as activeResponse object:
This method returns an object with no properties.
Example request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X PUT \
"${JACKDB_API_URL}/snippet/ScRthIsjOBol2ULt/version/243f5c00-cbc8-4857-b1c6-e117903ec854"
Example response:
{}