API Structure

The apis used in Feedback Module are developed in NodeJS and database used is MongoDB. Mongo stores data in JSON format. Data is called as a document in Mongo.

Commonly Used Terms

  • prodId: Product Id
  • collectionName: Name of the table from where you want to get data.
  • keyName: Primary key of the table
  • createdBy: User Name.

We have written some common and some page specific APIs. Following is the list:

Generic APIs

1). insertDocument

Description

API inserts any document.

Request details

  • method: POST

  • queryParams:

    • prodId
    • collectionName
    • keyName
    • createdBy
  • body: Any document Ex.

{
"questionId": '',
"status": '',
"elements":[],
"createdBy": ''.
"publishedDate": '',
"lastUpdatedBy":''
}

Response

{
"data": '' //primary key value
}

2). updateDocumentFirstLevel

Description

API updates any document.

Request details

  • method: POST

  • queryParams:

    • prodId
    • collectionName
    • keyName
    • updatedBy
  • body: Any document Ex.

{
"questionId": '',
"status": '',
"elements":[],
"createdBy": ''.
"publishedDate": '',
"lastUpdatedBy":''
}

Response

{
"data": '' //primary key value
}

3). getDocuments

Description

API returns the ids of all the documents.

Request details

  • method: POST

  • queryParams:

    • prodId
    • collectionName
    • keyName
    • createdBy
  • body:

{
"filter":{},
"sort": {},
"projection":{}
}

Response

{
"data": [] //idArr
}

4). getDocumentDetailByIds

Description

API gives the details of a document.

Request details

  • method: POST

  • queryParams:

    • prodId
    • collectionName
    • keyName
    • createdBy
  • body:

{
"ids":[],
"filter":{},
"sort": {},
"projection":{}
}

Response

{
"data": [] //array of objects of data
}

Question Set APIs

1). getResponseBasedFilteredDocuments

Description

API gives the details of users who have given a particular answer of a particular question.

Request details

  • method: POST

  • queryParams:

    • prodId
    • collectionName
    • keyName
    • createdBy
  • body:

{
"filter":{},
"sort": {},
"projection":{},
"elemFilterData": {}
}

Response

{
"data": [] //array of objects of data
}

2). getAverageResult

Description

API gives the average.

Request details

  • method: POST

  • queryParams:

    • prodId
  • body:

{
"filter":{},
}

Response

{
"data": [{
"average": ''
}]
}

DSC Enquiry APIs

1). insertAndSendEmail

Description

API inserts the enquiry and sends the email.

Request details

  • method: POST

  • queryParams:

    • prodId
    • createdBy
    • deptName
  • body: Any document Ex.

{
"title": ''
}

Response

{
"data": '' //reference No
}

User APIs

1). userDetails

Description

API gives and saves the user details after getting from Java.

Request details

  • method: POST

  • queryParams:

    • prodId
    • userCode
    • hostName
  • body:

{
}

Response

{
"data": [
{
}
] // user details
}

Logout APIs

1). logoutTW

Description

API gives and saves the user details after getting from Java.

Request details

  • method: POST

  • queryParams:

    • prodId
    • userId
    • dept
  • body:

{
}

Response

{
"responseSubmitted": true/false
}