DefinedTerm¶
A DefinedTerm is one coded term of a DefinedTermSet, such as an error code
of your API: its id is the code, chosen by you (ORDER_LOCKED), so a lookup is a plain read, and termCode repeats
it. name, description, causes and remedy explain it, in every language you write them in; httpStatus is the
status your API answers with it. internalNotes are for your support team: the default policy hides them from
anonymous callers. ObjectsGrid's own errors are described the same way, in
Error details. See Explain your API's errors.
Modeled on schema.org/DefinedTerm · JSON Schema · ABAC object type DefinedTerm
Example¶
Create one with POST /definedterms:
{
"id": "ORDER_LOCKED",
"inDefinedTermSet": {
"at_id": "https://apis.objectsgrid.com/definedtermsets/2f6e9a1c-4b3d-4e5f-8a7b-9c0d1e2f3a4b"
},
"name": [
{
"at_language": "en",
"at_value": "The order is locked"
},
{
"at_language": "de",
"at_value": "Die Bestellung ist gesperrt"
}
],
"description": [
{
"at_language": "en",
"at_value": "A shipped order can't change."
}
],
"causes": [
{
"at_language": "en",
"at_value": "The order shipped"
},
{
"at_language": "en",
"at_value": "The order was cancelled"
}
],
"remedy": [
{
"at_language": "en",
"at_value": "Create a return instead."
}
],
"httpStatus": 409,
"seeAlso": [
"https://docs.example.com/returns"
],
"mainEntityOfPage": "https://docs.example.com/errors/ORDER_LOCKED"
}
Fields¶
Required: id, inDefinedTermSet, name.
| Field | Type | Required | Description |
|---|---|---|---|
at_context |
https://schema.org |
JSON-LD @context, always https://schema.org. |
|
at_type |
DefinedTerm |
JSON-LD @type, the object's type name. |
|
at_id |
URL | The object's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>, its JSON-LD @id: what References to it hold. Assigned by ObjectsGrid. |
|
id |
string | Yes | The DefinedTerm's id, chosen by you: for an error code, the code itself, e.g. ORDER_LOCKED |
identifier |
string | The object's id, as Schema.org identifier. Assigned by ObjectsGrid. |
|
url |
URL | The object's own URL, https://apis.objectsgrid.com/<path>/<id>. Assigned by ObjectsGrid. |
|
termCode |
string | The code, as your API returns it: the id. Set by the service. | |
inDefinedTermSet |
Reference to DefinedTermSet | Yes | The set it belongs to |
name |
list of LanguageTaggedString | Yes | The term, or the error's title, e.g. The order is locked |
description |
list of LanguageTaggedString | What it means, or what happened | |
mainEntityOfPage |
URL | Your page about it, e.g. https://docs.example.com/errors/ORDER_LOCKED | |
causes |
list of LanguageTaggedString | The usual causes, one entry per cause and language. ObjectsGrid's own field. | |
remedy |
list of LanguageTaggedString | How to fix it. ObjectsGrid's own field. | |
httpStatus |
integer | The HTTP status your API answers with it, for an error. ObjectsGrid's own field. | |
seeAlso |
list of URL | Further reading. ObjectsGrid's own field. | |
supportContact |
ContactPoint | Who to ask about it. ObjectsGrid's own field. | |
internalNotes |
list of LanguageTaggedString | Notes for your support team, never for your API's callers: the default policy hides them from anonymous callers. ObjectsGrid's own field. | |
tags |
list of Tag | Tags your ABAC policy decides on. Created empty when not sent, kept by a PUT that leaves them out, cleared by null or []. |
|
meta |
ObjectMeta | Read-only metadata: version, type, creation and last update. |
REST API¶
Base URL https://apis.objectsgrid.com. Every request sends the X-ObjectsGrid-AccessPoint and Authorization: Bearer <access token> headers; see the REST API guide.
| Operation | Request |
|---|---|
| Create | POST /definedterms |
| List and search | GET /definedterms |
| Create up to 100 at once | POST /definedterms/batch |
| Retrieve | GET /definedterms/{id} |
| Replace | PUT /definedterms/{id} |
| Update some fields | PATCH /definedterms/{id} |
| Delete | DELETE /definedterms/{id} |
DefinedTerm objects have no JSON-LD document: asked for one (Accept: application/ld+json), GET answers 406.
The OpenAPI contract, with every parameter and response: DefinedTerms (JSON).
GraphQL¶
Endpoint POST https://apis.objectsgrid.com/graphql; see the GraphQL guide.
| Operation | Field |
|---|---|
| Query | definedTerm(id: ID!, version: String): DefinedTerm |
| Query | definedTerms(where: DefinedTermWhereInput, orderBy: [DefinedTermOrderByInput!], first: Int, after: String): DefinedTermConnection! |
| Query | definedTermsGroupBy(by: [DefinedTermGroupByField!]!, where: DefinedTermWhereInput, having: DefinedTermHavingInput, orderBy: [DefinedTermGroupByOrderByInput!], first: Int, after: String): DefinedTermGroupByConnection! |
| Mutation | createDefinedTerm(input: CreateDefinedTermInput!): DefinedTerm! |
| Mutation | updateDefinedTerm(input: UpdateDefinedTermInput!, expectedVersion: String): DefinedTerm! |
| Mutation | deleteDefinedTerm(id: ID!, expectedVersion: String): Boolean! |
Webhook events¶
Subscribe to these events in your webhook configuration to be called when a DefinedTerm changes:
DefinedTermCreated, DefinedTermUpdated, DefinedTermPatched, DefinedTermDeleted.