Coach Portal QNA API#

the api below is for coach only.

Get Pending Qna List#

requests

info

endpoint

/qna/pending/

method

GET

Authorization

required

desc

return a coach object

payload:

key

type

remarks

alias

String

if provided, a single entry will be return; else a paginated result

results (list):

{
  "count": 0, // total number of entry
  "next": "string" // url of the next page
  "previous": "string", // url of the prev page
  "results": [
    "id": 0,
    "Q1": "string",
    "Q2": "string",
    "alias": "string",
    "created_at": "YYYY-MM-DD",
    "tag": [
      {
        "id": 0,
        "name": "string",
        "alias": "string"
      },
    ],
    "accepted_order: boolean,
    "expiration": "YYYY-MM-DDTXXX" or null
  ]
}

Take QNA Order#

  • handle Qna order status; a coach need to take the order before answering the question;

  • the order will be valid for 24 hours. as expired, a cron will automatically changed the order status to cancelled

  • upon successfully answering the question, the order will be changed to completed;

the following will be rejected:
for the same QNA, a coach cannot take the order if they have cancelled it before;
a coach can only concurrently take not more than 3 orders;
an answered QNA will not accept new order;
if other coach is answering the question (QNAOrdre__status = pending), no new order will be accepted unless it has expired;

requests

info

endpoint

/qna/lock/

method

POST

Authorization

required

desc

return a QNAOrder object

payload:

key

type

remarks

qna

String

qna alias; used to query the qna object

status

String

status enum

status enum:

key

value

PD

pending

CL

cancelled

CP

completed

response:

status code

meaning

201

successfully took the order

202

successfully cancelled the order

403

read the error message

Answer QNA#

  • answer QNA;

  • only the coach that is taking the order will be able to answer the question;

  • a notification object will be created to notify user that the answer has been answered;

  • an email will be sent to user for the same purpose;

  • the order status will be updated the completed when answered;

requests

info

endpoint

/qna/answer/

method

POST

Authorization

required

desc

return a QNAOrder object

payload:

key

type

remarks

id

Integer

qna id, required

answer

String

required

suggestion

String

required

response:

status code

meaning

202

successfully answer the question