mardi 30 mai 2017

Sending JSON data as body element using HTTP POST method

I am bit confused on a task which involves backend web developement: I have to make simple contact us form backend solution 1st task involved form-data post method, but i am not really sure what to do on the 2nd task

Sending JSON data as body element using HTTP POST method

How should i understand this? Is it meant as sending data in json format, through ajax post method?

Full Task instructions

Create a simple “Contact us” form backend solution

Create a backend solution where data can be sent using two different approaches

  1. form-data POST method using simple HTML form
  2. Sending JSON data as body element using HTTP POST method

Backend endpoint requirements

  1. Backend has to retrieve following data a. email i. Email field validation ii. Field is required b. text i. Max 400 symbols ii. Field is required c. first_name i. Max 255 symbols ii. Field is not required d. last_name i. Max 255 symbols ii. Field is not required
  2. Backend has to respond with error messages in case of incorrect data
  3. Correct HTTP response status codes has to be used in case of sending data as JSON
  4. Preferably data has to be stored in database (free choice)
  5. Data has to be sent to following endpoints (URL) a. HTML form - /contact/html i. This has to have a simple HTML web form as well

    b. JSON data - /contact/json




Aucun commentaire:

Enregistrer un commentaire