Institute of Computer Science
  1. Courses
  2. 2022/23 fall
  3. Web Application Development (LTAT.05.004)
ET
Log in

Web Application Development 2022/23 fall

  • Home
  • Lectures
  • Practicals
  • Homework Submission
  • Message Board

Session 1.2: Postman

Postman is an API platform that helps developers to design, build, and test their APIs. We will use it to better understand the API architecture, how we can fetch resources on the internet, the HTTP request methods/verbs, the HTTP request and responses, and response status codes.

  • Install Postman
  • Run the following requests with Postman:

1. Method: GET URL: https://jsonplaceholder.typicode.com/posts

Does the request contain a body? What do you see in the response body?

Paste https://jsonplaceholder.typicode.com/posts into the address bar of your browser, what do see? What does that mean?


2.Method: GET URL: https://jsonplaceholder.typicode.com/posts/{id}

Note: replace {id} with a valid Id (e.g., 1 - 99)

What do you see in the response body? What is the status code?


3.Method: GET URL: https://jsonplaceholder.typicode.com/posts/101

What is the status code?


4.Method: GET URL: https://jsonplaceholder.typicode.com/comments?postId=1

What do you see in the response body?

Note: "?" stands for the start of a query. Accordingly, /comments?postId=1 means return all comments on post with Id =1 in this context.


5.Method: POST URL: https://jsonplaceholder.typicode.com/posts

 Headers: 
{
      "Content-type": "application/json; charset=UTF-8"
}
Body: 
{
        "userId": 1,
	"title": "PostTitle",
	"body": "PostBody"
}

What are the main differences between GET and POST?


6.Method: PUT URL: https://jsonplaceholder.typicode.com/posts/5

 Headers: 
{
      "Content-type": "application/json; charset=UTF-8"
}
Body: 
{       "id": 1,
        "userId": 1,
	"title": "UpdatedTitle",
	"body": "UpdatedBody"
}

Tasks:

Try to run the following requests with Postman by yourself. Do not forget to replace {id} with a valid number. Try to run each request with several different {id}, and check the response head, body, and code.


1. Method: GET URL: https://jsonplaceholder.typicode.com/posts/{id}/comments


2. Method: GET URL: https://jsonplaceholder.typicode.com/posts?userId={id}


3.Method: PATCH URL: https://jsonplaceholder.typicode.com/posts/{id}

 Headers: 
{
            "Content-type": "application/json; charset=UTF-8"
}
Body: 
{ 
	"title": "A New Title",
}

4. Method: DELETE URL: https://jsonplaceholder.typicode.com/posts/{id}


  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment