Arvutiteaduse instituut
  1. Kursused
  2. 2024/25 kevad
  3. Ettevõttesüsteemide integreerimine (MTAT.03.229)
EN
Logi sisse

Ettevõttesüsteemide integreerimine 2024/25 kevad

  • Home
  • Lectures
  • Practicals
  • Assignements
  • Project and exam
  • Message Board

Session 2.2: Postman - [Pre Lab]

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, the HTTP request methods/verbs, the HTTP request and responses, and response status codes.

  • Install Postman

Postman interface

We can run the following requests with Postman to test our Rest API project:

1. GET all products

Method: GET
URI: http://localhost:8080/products

2. GET a product by id

Method:  GET
URI: http://localhost:8080/products/{id}

Note: replace {id} with a valid Id (e.g., 01, 02, 03, i.e., http://localhost:8080/products/01)

3. Add a new product

Method: POST
URI: http://localhost:8080/products 

  Headers: 
{
      "Content-type": "application/json"
}

  Body:
  {
    "id": "04",
    "name": "new light vehicle",
    "type": "Light another new",
    "description": "Can also be used for light work",
    "price": 1250
  }

4. Try GET all products again to see the newly added product.

5. Update an existing product

Method:  PUT
URI: http://localhost:8080/products/{id}
Example: http://localhost:8080/products/04

 Headers:
  {
      "Content-type": "application/json"
  }

 Body:
  {
    "id": "04",
    "name": "new light vehicle",
    "type": "Light another new",
    "description": "Updated - Can also be used for light work",
    "price": 1290
  }

6. Try GET all products again to see the updated product.

7. Delete a product

Method:  DELETE	
URI: http://localhost:8080/products/{id}
Example: http://localhost:8080/products/04

8. Try GET all products again to see whether the product was deleted

  • Arvutiteaduse instituut
  • Loodus- ja täppisteaduste valdkond
  • Tartu Ülikool
Tehniliste probleemide või küsimuste korral kirjuta:

Kursuse sisu ja korralduslike küsimustega pöörduge kursuse korraldajate poole.
Õppematerjalide varalised autoriõigused kuuluvad Tartu Ülikoolile. Õppematerjalide kasutamine on lubatud autoriõiguse seaduses ettenähtud teose vaba kasutamise eesmärkidel ja tingimustel. Õppematerjalide kasutamisel on kasutaja kohustatud viitama õppematerjalide autorile.
Õppematerjalide kasutamine muudel eesmärkidel on lubatud ainult Tartu Ülikooli eelneval kirjalikul nõusolekul.
Courses’i keskkonna kasutustingimused