Nodeblocks Review Service Default Adapter API Specification (1.0)

Download OpenAPI specification:Download

ReviewService API spec (Default Adapter)

API documentation for ReviewService default adapter.

App

Get app status

Retrieves app status information.

Responses

Response samples

Content type
application/json
{
  • "status": "ok",
  • "packageInfo": {
    }
}

Review Org By Users

Get organizations reviews by a user

Retrieves list of review by user for organizations

Authorizations:
(Authorizationx-nb-fingerprint)
path Parameters
userId
required
string (userId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of a user.

Responses

Response samples

Content type
application/json
{}

Update a organization review by user

Update a organization review by user

Validations

  • User can only update their own reviews

Side Effects

  • The reviewStats field for the organization service will be updated
    • If this fails, then a message will be logged and the request will still succeed
Authorizations:
(Authorizationx-nb-fingerprint)
path Parameters
reviewId
required
string (reviewId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of a review.

userId
required
string (userId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of a user.

Request Body schema: application/json

Patch a review request body.

comment
string

The body comment for a review

isAnonymous
boolean

Flag to indicate whether a review is anonymous or not.

rate
integer [ 1 .. 5 ]

The rating the reviewer gave to the reviewee. Technically this can be any number, but generally it is a number between 1 and 5.

subRates
object

The sub-ratings the reviewer gave to the reviewee. These ratings can be used to rate different aspects of the reviewee. Specify the name of the subRatings with a string key, and the value with a number between 1 and 5.

customFields
object (customFields.field)

Custom fields that have been added to the customFields options in createReviewDefaultAdapter.

Responses

Request samples

Content type
application/json
{
  • "comment": "string",
  • "isAnonymous": true,
  • "rate": 1,
  • "subRates": {
    },
  • "customFields": {
    }
}

Response samples

Content type
application/json
{
  • "id": "0123456789ab0123456789ab"
}

Delete a organization review by user

Delete a organization review by user

Validations

  • User can only delete their own reviews

Side Effects

  • The reviewStats field for the organization service will be updated
    • If this fails, then a message will be logged and the request will still succeed
Authorizations:
(Authorizationx-nb-fingerprint)
path Parameters
reviewId
required
string (reviewId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of a review.

userId
required
string (userId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of a user.

Responses

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "target": "string",
  • "details": [
    ],
  • "innererror": {
    }
}

Get reviews for one org

Retrieves reviews by org id

Authorizations:
(Authorizationx-nb-fingerprint)
path Parameters
orgId
required
string (orgId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of an organization.

Responses

Response samples

Content type
application/json
{}

Create a new review for one org

Create a new review for an organization.

Validations

  • Only order that has been completed can be reviewed
  • reviewBy must be a login user id

Side Effects

  • The reviewStats field for the organization service will be updated
    • If this fails, then a message will be logged and the request will still succeed
Authorizations:
(Authorizationx-nb-fingerprint)
path Parameters
orgId
required
string (orgId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of an organization.

query Parameters
$expand
string

Include extra information that are not included in responses by default in the response. By default, the fields that supports this query contain only uri for referring to the full information of it. To include the full information of the field, specify the field by $expand.

You can expand recursively by specifying nested fields after a dot (.). until For example, requesting product.category on a product image will expand the product property into a full product object, and will then expand the category property on that product into a full category object. Expansions have a maximum depth of 3 levels.

You can use the expand param on any endpoint which returns expandable fields, including list, create, and update endpoints.

You can expand multiple objects at once by identifying multiple items in comma-separated style.

Examples:

Include full category and organization information in the response.

Before expanding,

{
  ...
  "category": {
    "uri": "https://{{catalogServiceEndpoint}}/categories/01234567890123456789ab"
  },
  "organization": {
    "uri": "https://{{organizationServiceEndpoint}}/organization/01234567890123456789ab"
  },
  ...
}

By using $expand parameter,

$expand=category,organization

It will returns full information:

{
  ...
  "category": {
    "id": "01234567890123456789ab",
    "name": "Category A",
    "description": "Description of Category A.",
    ...
  },
  "organization": {
    "id": "01234567890123456789ab",
    "name": "Org A",
    "description": "Description of Org A.",
    ...
  },
  ...
}
Request Body schema: application/json

Post a review request body.

comment
string

The body comment for a review

isAnonymous
boolean

Flag to indicate whether a review is anonymous or not.

source
string
Enum: "user" "organization"

The type of the reviewer (the one performing the review)

target
string
Enum: "user" "organization" "product"

The type of the reviewee (the one receiving the review)

rate
integer [ 1 .. 5 ]

The rating the reviewer gave to the reviewee. Technically this can be any number, but generally it is a number between 1 and 5.

reviewedBy
string (objectId) ^[0-9a-z]{24}$

The unique identifier of the reviewer.

subRates
object

The sub-ratings the reviewer gave to the reviewee. These ratings can be used to rate different aspects of the reviewee. Specify the name of the subRatings with a string key, and the value with a number between 1 and 5.

customFields
object (customFields.field)

Custom fields that have been added to the customFields options in createReviewDefaultAdapter.

Responses

Request samples

Content type
application/json
{
  • "comment": "string",
  • "isAnonymous": true,
  • "source": "user",
  • "target": "user",
  • "rate": 1,
  • "reviewedBy": "0123456789ab0123456789ab",
  • "subRates": {
    },
  • "customFields": {
    }
}

Response samples

Content type
application/json
{
  • "id": "0123456789ab0123456789ab"
}

Review User By Orgs

Get reviews for one user

Retrive reviews for one user by organizations

Authorizations:
(Authorizationx-nb-fingerprint)
path Parameters
userId
required
string (userId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of a user.

Responses

Response samples

Content type
application/json
{}

Create a new review for one user

Create a new review for an user by organization.

Validations

  • Login user must be in organization
  • Only order that has been completed can be reviewed

Side Effects

  • The reviewStats field for the user service will be updated
    • If this fails, then a message will be logged and the request will still succeed
Authorizations:
(Authorizationx-nb-fingerprint)
path Parameters
userId
required
string (userId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of a user.

query Parameters
$expand
string

Include extra information that are not included in responses by default in the response. By default, the fields that supports this query contain only uri for referring to the full information of it. To include the full information of the field, specify the field by $expand.

You can expand recursively by specifying nested fields after a dot (.). until For example, requesting product.category on a product image will expand the product property into a full product object, and will then expand the category property on that product into a full category object. Expansions have a maximum depth of 3 levels.

You can use the expand param on any endpoint which returns expandable fields, including list, create, and update endpoints.

You can expand multiple objects at once by identifying multiple items in comma-separated style.

Examples:

Include full category and organization information in the response.

Before expanding,

{
  ...
  "category": {
    "uri": "https://{{catalogServiceEndpoint}}/categories/01234567890123456789ab"
  },
  "organization": {
    "uri": "https://{{organizationServiceEndpoint}}/organization/01234567890123456789ab"
  },
  ...
}

By using $expand parameter,

$expand=category,organization

It will returns full information:

{
  ...
  "category": {
    "id": "01234567890123456789ab",
    "name": "Category A",
    "description": "Description of Category A.",
    ...
  },
  "organization": {
    "id": "01234567890123456789ab",
    "name": "Org A",
    "description": "Description of Org A.",
    ...
  },
  ...
}
Request Body schema: application/json

Post a review request body.

comment
string

The body comment for a review

isAnonymous
boolean

Flag to indicate whether a review is anonymous or not.

source
string
Enum: "user" "organization"

The type of the reviewer (the one performing the review)

target
string
Enum: "user" "organization" "product"

The type of the reviewee (the one receiving the review)

rate
integer [ 1 .. 5 ]

The rating the reviewer gave to the reviewee. Technically this can be any number, but generally it is a number between 1 and 5.

reviewedBy
string (objectId) ^[0-9a-z]{24}$

The unique identifier of the reviewer.

subRates
object

The sub-ratings the reviewer gave to the reviewee. These ratings can be used to rate different aspects of the reviewee. Specify the name of the subRatings with a string key, and the value with a number between 1 and 5.

customFields
object (customFields.field)

Custom fields that have been added to the customFields options in createReviewDefaultAdapter.

Responses

Request samples

Content type
application/json
{
  • "comment": "string",
  • "isAnonymous": true,
  • "source": "user",
  • "target": "user",
  • "rate": 1,
  • "reviewedBy": "0123456789ab0123456789ab",
  • "subRates": {
    },
  • "customFields": {
    }
}

Response samples

Content type
application/json
{
  • "id": "0123456789ab0123456789ab"
}

Get reviews for one organization

Retrieves reviews for one organization

Validations

  • Login user must be in organization
Authorizations:
(Authorizationx-nb-fingerprint)
path Parameters
orgId
required
string (orgId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of an organization.

Responses

Response samples

Content type
application/json
{}

Update a review created by one org

Update a review created by one org

Validations

  • Login user must be admin or owner for the organization

Side Effects

  • The reviewStats field for the user service will be updated
    • If this fails, then a message will be logged and the request will still succeed
Authorizations:
(Authorizationx-nb-fingerprint)
path Parameters
orgId
required
string (orgId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of an organization.

reviewId
required
string (reviewId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of a review.

Request Body schema: application/json

Patch a review request body.

comment
string

The body comment for a review

isAnonymous
boolean

Flag to indicate whether a review is anonymous or not.

rate
integer [ 1 .. 5 ]

The rating the reviewer gave to the reviewee. Technically this can be any number, but generally it is a number between 1 and 5.

subRates
object

The sub-ratings the reviewer gave to the reviewee. These ratings can be used to rate different aspects of the reviewee. Specify the name of the subRatings with a string key, and the value with a number between 1 and 5.

customFields
object (customFields.field)

Custom fields that have been added to the customFields options in createReviewDefaultAdapter.

Responses

Request samples

Content type
application/json
{
  • "comment": "string",
  • "isAnonymous": true,
  • "rate": 1,
  • "subRates": {
    },
  • "customFields": {
    }
}

Response samples

Content type
application/json
{
  • "id": "0123456789ab0123456789ab"
}

Delete a review created by one org

Delete a review created by one org

Validations

  • Login user must be admin or owner for the organization

Side Effects

  • The reviewStats field for the user service will be updated
    • If this fails, then a message will be logged and the request will still succeed
Authorizations:
(Authorizationx-nb-fingerprint)
path Parameters
orgId
required
string (orgId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of an organization.

reviewId
required
string (reviewId) ^[0-9a-z]{24}$
Example: 0123456789ab0123456789ab

A unique identifier of a review.

Responses

Response samples

Content type
application/json
{
  • "code": "string",
  • "message": "string",
  • "target": "string",
  • "details": [
    ],
  • "innererror": {
    }
}