Viewer Service API(s) Specification

Introduction:

This wiki give the details about Viewer Service API(s) Spec design details.

Base Request Spec:

  • Authorization and x-authenticated-user-token are mandatory headers in every request

  • UserId will be captured using the user-token from headers for all api requests

{ "id": "api.view", // required. id of the api request "ver": "1.0", // required. Current version of api "ts": "2021-01-01T00:00:00+05:30", //mandatory. Timestamp of the request "params": { "msgid": "4f04da60-1e24-4d31-aa7b-1daf91c46341" // unique request message id, UUID }, "request": { // required .... .... }

API Spec

 

Content View Start

Request Spec:

{ "id": "api.view.start", "ver": "v1", "ts": "2021-06-23 05:37:40:575+0000", "params": { "msgid": "5e763bc2-b072-440d-916e-da787881b1b9" }, "request": { "contentId": "{{contentId}}", // required "collectionId" : "{{collectionId}}" // optional "contextId": "{{batchId}}" // optional } }

Sample Requests:

Sample1: consume organic content

{ "id": "api.view.start", "ver": "v1", "ts": "2021-06-23 05:37:50:175+0000", "params": { "msgid": "5e763bc2-b072-440d-916e-da787881b1b9" } "request": { "contentId" : "content_123" }

Sample2: consume content through collection

Sample3: consume content through context

Response:

200 Ok Response:

4XX or 5XX Error Response:

Sample Response:

Sample1: Valid Request

Sample2: InValid Request

Sample3: Invalid ContextId in Request

 

Content View Update

Request:

Sample Requests:

Sample1: Without Context

Sample1: With Context

 

Response:

Content View End

Request:

Sample Request:

Sample1: Without Context

Sample2: With Context

 

Response:

Request:

Response:

Sample Response:

Sample1: Without context(organic consumption)

Example2: With context or collection

Request:

Response:

Sample Response:

 

Clarifications:

  • For assessment submit, do we need consider the assess events without context as well