Rating¶
A Rating is one score given to an item, for example 4 out of 5 stars, optionally for one aspect such as price or delivery. It stands on its own: a Review links to its rating, but a rating needs no review. To show the average of many ratings, use an AggregateRating on the item.
Modeled on schema.org/Rating · JSON Schema · ABAC object type Rating
Example¶
Create one with POST /ratings:
{
"itemReviewed": {
"at_id": "https://apis.objectsgrid.com/products/2b5f8f0e-1d0c-4d61-9a7e-5a1f0c3e9d21"
},
"author": {
"at_id": "https://apis.objectsgrid.com/organizations/9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"
},
"ratingValue": 4,
"bestRating": 5,
"worstRating": 1,
"reviewAspect": "quality"
}
Fields¶
Required: itemReviewed, author, ratingValue.
| Field | Type | Required | Description |
|---|---|---|---|
at_context |
https://schema.org |
JSON-LD @context, always https://schema.org. |
|
at_type |
Rating |
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. |
|
itemReviewed |
Reference to Product or ProductGroup or ProductModel or Service or Organization or Place or Brand or Offer | Yes | URL of the item being rated, e.g. a Product, Service, Organization or Place. Objects Grid extension: schema.org defines itemReviewed on Review and AggregateRating; it is required here because a Rating can exist without a Review. |
author |
Reference to Person or Organization | Yes | URL of the Person or Organization that provided the Rating |
ratingValue |
number | Yes | The rating given to the item. Must be between worstRating and bestRating. |
bestRating |
number | The highest value allowed in this rating system | |
worstRating |
number | The lowest value allowed in this rating system | |
ratingExplanation |
list of LanguageTaggedString | A short explanation of the reasoning behind the rating value | |
reviewAspect |
string | The aspect of the item being rated, e.g. 'quality', 'price', 'delivery' | |
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 /ratings |
| List and search | GET /ratings |
| Create up to 100 at once | POST /ratings/batch |
| Retrieve | GET /ratings/{id} |
| Retrieve as a JSON-LD document for your pages | GET /ratings/{id} with Accept: application/ld+json; see JSON-LD for your pages |
| Replace | PUT /ratings/{id} |
| Update some fields | PATCH /ratings/{id} |
| Delete | DELETE /ratings/{id} |
The OpenAPI contract, with every parameter and response: Ratings (JSON).
GraphQL¶
Endpoint POST https://apis.objectsgrid.com/graphql; see the GraphQL guide.
| Operation | Field |
|---|---|
| Query | rating(id: ID!, version: String): Rating |
| Query | ratings(where: RatingWhereInput, orderBy: [RatingOrderByInput!], first: Int, after: String): RatingConnection! |
| Query | ratingsGroupBy(by: [RatingGroupByField!]!, where: RatingWhereInput, having: RatingHavingInput, orderBy: [RatingGroupByOrderByInput!], first: Int, after: String): RatingGroupByConnection! |
| Mutation | createRating(input: CreateRatingInput!): Rating! |
| Mutation | updateRating(input: UpdateRatingInput!, expectedVersion: String): Rating! |
| Mutation | deleteRating(id: ID!, expectedVersion: String): Boolean! |
Webhook events¶
Subscribe to these events in your webhook configuration to be called when a Rating changes:
RatingCreated, RatingUpdated, RatingPatched, RatingDeleted.