Skip to content

Latest commit

 

History

History
255 lines (203 loc) · 7.16 KB

File metadata and controls

255 lines (203 loc) · 7.16 KB

# REST Client for VS Code (humao.rest-client) # https://marketplace.visualstudio.com/items?itemName=humao.rest-client

@baseUrl = http://localhost:9000 @newSquadNumber = 27 @existingSquadNumber = 23

# ----------------------------------------------------------------------------- # GET /health # -----------------------------------------------------------------------------

### Request GET /health → Response status 200 OK GET {{baseUrl}}/health

# ----------------------------------------------------------------------------- # GET /players # -----------------------------------------------------------------------------

### Request GET /players → Response status 200 OK GET {{baseUrl}}/players

# ----------------------------------------------------------------------------- # GET /players/:id (replace with a real UUID from GET /players) # -----------------------------------------------------------------------------

### Request GET /players/{id} existing → Response status 200 OK GET {{baseUrl}}/players/00000000-0000-0000-0000-000000000000

### Request GET /players/{id} nonexistent → Response status 404 Not Found GET {{baseUrl}}/players/00000000-0000-0000-0000-000000000001

# ----------------------------------------------------------------------------- # GET /players/squadNumber/:squadNumber # -----------------------------------------------------------------------------

### Request GET /players/squadNumber/{squadNumber} existing → Response status 200 OK GET {{baseUrl}}/players/squadNumber/10

### Request GET /players/squadNumber/{squadNumber} unknown → Response status 404 Not Found GET {{baseUrl}}/players/squadNumber/999

# ----------------------------------------------------------------------------- # POST /players # -----------------------------------------------------------------------------

### Request POST /players body nonexistent → Response status 201 Created POST {{baseUrl}}/players Content-Type: application/json

{
"firstName": "Giovani", "lastName": "Lo Celso", "dateOfBirth": "1996-04-09T00:00:00.000Z", "squadNumber": 27, "position": "Central Midfield", "abbrPosition": "CM", "team": "Villarreal CF", "league": "La Liga", "starting11": false

}

### Request POST /players body existing → Response status 409 Conflict POST {{baseUrl}}/players Content-Type: application/json

{
"firstName": "Damián", "middleName": "Emiliano", "lastName": "Martínez", "dateOfBirth": "1992-09-02T00:00:00.000Z", "squadNumber": 23, "position": "Goalkeeper", "abbrPosition": "GK", "team": "Aston Villa FC", "league": "Premier League", "starting11": true

}

### Request POST /players body empty → Response status 400 Bad Request POST {{baseUrl}}/players Content-Type: application/json

{}

### Request POST /players firstName missing → Response status 400 Bad Request POST {{baseUrl}}/players Content-Type: application/json

{
"lastName": "Doe", "squadNumber": 10, "position": "Forward"

}

### Request POST /players lastName missing → Response status 400 Bad Request POST {{baseUrl}}/players Content-Type: application/json

{
"firstName": "John", "squadNumber": 10, "position": "Forward"

}

### Request POST /players squadNumber missing → Response status 400 Bad Request POST {{baseUrl}}/players Content-Type: application/json

{
"firstName": "John", "lastName": "Doe", "position": "Forward"

}

### Request POST /players position missing → Response status 400 Bad Request POST {{baseUrl}}/players Content-Type: application/json

{
"firstName": "John", "lastName": "Doe", "squadNumber": 10

}

### Request POST /players squadNumber >99 → Response status 400 Bad Request POST {{baseUrl}}/players Content-Type: application/json

{
"firstName": "John", "lastName": "Doe", "squadNumber": 100, "position": "Forward"

}

### Request POST /players squadNumber <1 → Response status 400 Bad Request POST {{baseUrl}}/players Content-Type: application/json

{
"firstName": "John", "lastName": "Doe", "squadNumber": 0, "position": "Forward"

}

# ----------------------------------------------------------------------------- # PUT /players/squadNumber/:squadNumber # -----------------------------------------------------------------------------

### Request PUT /players/squadNumber/{squadNumber} existing → Response status 204 No Content PUT {{baseUrl}}/players/squadNumber/{{existingSquadNumber}} Content-Type: application/json

{
"firstName": "Emiliano", "middleName": null, "lastName": "Martínez", "dateOfBirth": "1992-09-02T00:00:00.000Z", "squadNumber": 23, "position": "Goalkeeper", "abbrPosition": "GK", "team": "Aston Villa FC", "league": "Premier League", "starting11": true

}

### Request PUT /players/squadNumber/{squadNumber} nonexistent → Response status 404 Not Found PUT {{baseUrl}}/players/squadNumber/99 Content-Type: application/json

{
"firstName": "John", "lastName": "Doe", "squadNumber": 99, "position": "Forward"

}

### Request PUT /players/squadNumber/{squadNumber} body empty → Response status 400 Bad Request PUT {{baseUrl}}/players/squadNumber/{{existingSquadNumber}} Content-Type: application/json

{}

### Request PUT /players/squadNumber/{squadNumber} firstName missing → Response status 400 Bad Request PUT {{baseUrl}}/players/squadNumber/{{existingSquadNumber}} Content-Type: application/json

{
"lastName": "Doe", "squadNumber": 10, "position": "Forward"

}

### Request PUT /players/squadNumber/{squadNumber} lastName missing → Response status 400 Bad Request PUT {{baseUrl}}/players/squadNumber/{{existingSquadNumber}} Content-Type: application/json

{
"firstName": "John", "squadNumber": 10, "position": "Forward"

}

### Request PUT /players/squadNumber/{squadNumber} squadNumber missing → Response status 400 Bad Request PUT {{baseUrl}}/players/squadNumber/{{existingSquadNumber}} Content-Type: application/json

{
"firstName": "John", "lastName": "Doe", "position": "Forward"

}

### Request PUT /players/squadNumber/{squadNumber} position missing → Response status 400 Bad Request PUT {{baseUrl}}/players/squadNumber/{{existingSquadNumber}} Content-Type: application/json

{
"firstName": "John", "lastName": "Doe", "squadNumber": 10

}

### Request PUT /players/squadNumber/{squadNumber} squadNumber >99 → Response status 400 Bad Request PUT {{baseUrl}}/players/squadNumber/{{existingSquadNumber}} Content-Type: application/json

{
"firstName": "John", "lastName": "Doe", "squadNumber": 100, "position": "Forward"

}

### Request PUT /players/squadNumber/{squadNumber} squadNumber <1 → Response status 400 Bad Request PUT {{baseUrl}}/players/squadNumber/{{existingSquadNumber}} Content-Type: application/json

{
"firstName": "John", "lastName": "Doe", "squadNumber": 0, "position": "Forward"

}

# ----------------------------------------------------------------------------- # DELETE /players/squadNumber/:squadNumber # -----------------------------------------------------------------------------

### Request DELETE /players/squadNumber/{squadNumber} existing → Response status 204 No Content DELETE {{baseUrl}}/players/squadNumber/{{newSquadNumber}}

### Request DELETE /players/squadNumber/{squadNumber} nonexistent → Response status 404 Not Found DELETE {{baseUrl}}/players/squadNumber/99