Answer¶
An Answer answers a Question (parentItem), written by another shopper (a
Person) or by the seller (an Organization), with votes your app keeps.
Modeled on schema.org/Answer · JSON Schema · ABAC object type Answer
Example¶
Create one with POST /answers:
{
"text": [
{
"at_language": "en",
"at_value": "Very quiet: you hear it click off."
}
],
"parentItem": {
"at_id": "https://apis.objectsgrid.com/questions/5d6e7f80-91a2-4b3c-8d4e-5f6a7b8c9d0e"
},
"author": {
"at_id": "https://apis.objectsgrid.com/organizations/2a3b4c5d-6e7f-4a8b-9c0d-1e2f3a4b5c6d"
}
}
Fields¶
Required: text, parentItem.
| Field | Type | Required | Description |
|---|---|---|---|
at_context |
https://schema.org |
JSON-LD @context, always https://schema.org. |
|
at_type |
Answer |
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 | The object's id. Assigned by ObjectsGrid when the object is created. | |
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. |
|
text |
list of LanguageTaggedString | Yes | The answer |
parentItem |
Reference to Question | Yes | The Question it answers |
author |
Reference to Person or Organization | Who answered: the URL of a Person or Organization (the seller), stored as |
|
dateCreated |
date-time | When it was written | |
upvoteCount |
integer | Up votes, kept by the app | |
downvoteCount |
integer | Down votes, kept by the app | |
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 /answers |
| List and search | GET /answers |
| Create up to 100 at once | POST /answers/batch |
| Retrieve | GET /answers/{id} |
| Retrieve as a JSON-LD document for your pages | GET /answers/{id} with Accept: application/ld+json; see JSON-LD for your pages |
| Replace | PUT /answers/{id} |
| Update some fields | PATCH /answers/{id} |
| Delete | DELETE /answers/{id} |
The OpenAPI contract, with every parameter and response: Answers (JSON).
GraphQL¶
Endpoint POST https://apis.objectsgrid.com/graphql; see the GraphQL guide.
| Operation | Field |
|---|---|
| Query | answer(id: ID!, version: String): Answer |
| Query | answers(where: AnswerWhereInput, orderBy: [AnswerOrderByInput!], first: Int, after: String): AnswerConnection! |
| Query | answersGroupBy(by: [AnswerGroupByField!]!, where: AnswerWhereInput, having: AnswerHavingInput, orderBy: [AnswerGroupByOrderByInput!], first: Int, after: String): AnswerGroupByConnection! |
| Mutation | createAnswer(input: CreateAnswerInput!): Answer! |
| Mutation | updateAnswer(input: UpdateAnswerInput!, expectedVersion: String): Answer! |
| Mutation | deleteAnswer(id: ID!, expectedVersion: String): Boolean! |
Webhook events¶
Subscribe to these events in your webhook configuration to be called when an Answer changes:
AnswerCreated, AnswerUpdated, AnswerPatched, AnswerDeleted.