You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

Endpoint dedicated to the generation and manipulation of feedback. All feedback are stored in the selected search engine, in the autogenerated feedback index (by default sa_feedback)

All the request which accepts a body use the following model

FieldTypeDescription
usernamestringUsername submitting the feedback
commentsstringComment of the feedback
ratingnumberRating given to the feedback (0-5)
metadataobjectAdditional data to provide context for feedback
timestampintegerTimestamp of the feedback (optional)

The body of the feedback request is directly related with the index of the NonSQL engine. And can be modified here models/api/feedback.py 

Get Feedback

This endpoint retrieves a specific feedback by its ID. If no query is provided, it returns all the feedback data.

Path Parameters

ParameterTypeDescription
feedback_idpathID of the feedback to fetch

Example

GET /es/api/v1/feedback/{feedback_id}

Response

Successful Response [200]

{
  "id": "7tUf2ogBKXyr_Xtc4seO",
  "username": "string",
  "comments": "string",
  "rating": 5,
  "metadata": {
    "something": true
  },
  "timestamp": "2023-06-20T12:46:15-0600"
}

Validation Error [422]

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Create Feedback

Creates a specific feedback. Requires feedback ID and authorization.

Parameters

This endpoint does not require any parameters.

Example

POST /es/api/v1/feedback/

{
"username": "john_doe",
"comments": "Great service!",
"rating": 5,
"metadata": {}
}

Response

Successful Response [200]

{
  "feedback_id": "LNV12ogBKXyr_XtcNsjC",
  "result": "created"
}

Validation Error [422]

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Update Feedback

This endpoint updates a specific feedback identified by its ID. A valid feedback ID and authorization are required.

Path Parameters

ParameterTypeDescription
feedback_idstringID of the feedback to update

Example

PUT /es/api/v1/feedback/{feedback_id}

{
  "username": "john_doe",
  "comments": "Excellent service!",
  "rating": 5,
  "metadata": {}
}

Response

Successful Response [200]

{
  "feedback_id": "LNV12ogBKXyr_XtcNsjC",
  "result": "created"
}

Validation Error [422]

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Delete Feedback

Deletes a specific feedback based on the provided feedback ID. Admin role and feedback ID are required for this action.

Path Parameters

ParameterTypeDescription
feedback_idstringID of the feedback to delete

Example

DELETE /es/api/v1/feedback/{feedback_id}

Response

Successful Response [200]

{
  "feedback_id": "7tUf2ogBKXyr_Xtc4seO",
  "result": "deleted"
}

Validation Error [422]

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Get Feedbacks

This endpoint retrieves a list of feedbacks. If no query is provided, it returns all the feedback data.

Query Parameters

Parameter

Type

Description

Required

query

string

Matches will be done comparing username or comments

No

sort_asc

bool

Sorting option of the results based on the username (default: Descending)

No

max_values

integer

Max values to return (default: 10)

No

Example

GET /es/api/v1/feedback/?query=example&sort_asc=true&max_values=5

Response

Successful Response [200]

{
  "total": 5,
  "feedbacks": [
    {
      "id": "123",
      "username": "jane_smith",
      "comments": "Great job!",
      "rating": 4,
      "metadata": {},
      "timestamp": "2023-06-20T12:45:52-0600"
    },
    {
      "id": "456",
      "username": "john_doe",
      "comments": "Excellent service!",
      "rating": 5,
      "metadata": {},
      "timestamp": "2023-06-20T12:45:52-0600"
    },
    ...
  ]
}

Validation Error [422]

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
  • No labels