📄Forms Handling

(Not avaliable for the general public)

Methods allowed:

API ENDPOINT: /v1/forms

  • POST /create/:otp?customID=value&qtn1-8=value

  • POST /edit/:formid/:otp?qtn1-8=value

  • GET /get/:formid

  • POST/send/:otp?aws1-8=value

/CREATE [POST]

SECURITY: TRUE - TYPE: USER SESSION - ROLE: STAFF ACTION: Creates a form by parsing a query with the query info. RESULT: JSON

-> REQUEST URL

/v1/forms/create/<CUSTOMID>?sessionToken=<SESSIONID>

CustomID is the id of the form that will be created. Its mandatory to send an CustomID

-> REQUEST BODY

{
    "qtn1": "<STRING>",
    "qtn2": "<STRING>",
    "qtn3": "<STRING>",
    "qtn4": "<STRING>",
    "qtn5": "<STRING>",
    "qtn6": "<STRING>",
    "qtn7": "<STRING>",
    "qtn8": "<STRING>"
}

-> RESULT

{
    "message": "Form Sent",
    "id": "<FORMID>",
    "owner": {
        "username": "<STRING>",
        "id": "<STRING>"
    }
}

/EDIT [POST]

SECURITY: TRUE - TYPE: USER SESSION - ROLE: STAFF ACTION: Edits a form by parsing a body with the new form questions. RESULT: JSON

-> REQUEST URL

/v1/forms/edit/<FORMID>?sessionToken=<SESSIONID>

-> REQUEST BODY

{
    "qtn1": "<STRING>",
    "qtn2": "<STRING>",
    "qtn3": "<STRING>",
    "qtn4": "<STRING>",
    "qtn5": "<STRING>",
    "qtn6": "<STRING>",
    "qtn7": "<STRING>",
    "qtn8": "<STRING>"
}

-> RESULT

{
    "message": "Form questions Edited",
    "id": "<FORMID>"
}

/GET [GET]

SECURITY: TRUE - TYPE: USER SESSION TOKEN ACTION: Fetches form information and generates OTP for sending answer. RESULT: JSON

-> REQUEST

/v1/forms/get/<FORMID>?sessionToken=<SESSIONID>

-> RESULT

{
   "message": "Succefuly Fetched Form",
   "questions": {
      "1": "<QUESTION>",
      "2": "<QUESTION>",
      "3": "<QUESTION>",
      "4": "<QUESTION>",
      "5": "<QUESTION>",
      "6": "<QUESTION>",
      "7": "<QUESTION>",
      "8": "<QUESTION>",
   },
   "ID": "<FORMID>",
   "OTP": "<GENERATED OTP FOR SENDING FORM>",
   "user": {//logged user session
      "username": "<USER USERNAME>",
      "id": "<USER ID>"
   }
}

/SEND [POST]

SECURITY: TRUE - TYPE: SERVER GENERATED OTP FROM /GET ACTION: Sends a form by parsing a body with the forms answers. RESULT: JSON

-> REQUEST URL

/v1/forms/send/<OTP>?formID=<FORMID>

-> REQUEST BODY

{
    "aws1": "<STRING>",
    "aws2": "<STRING>",
    "aws3": "<STRING>",
    "aws4": "<STRING>",
    "aws5": "<STRING>",
    "aws6": "<STRING>",
    "aws7": "<STRING>",
    "aws8": "<STRING>"
}

-> RESULT

{
    "message": "Form Sent",
    "id": "<FORMID>",
    "owner": {
        "username": "<STRING>",
        "id": "<STRING>"
    }
}

Last updated