POST
/api/v1/swap-requests
curl \
--request POST 'http://localhost:8080/api/v1/swap-requests' \
--header "Content-Type: application/json" \
--data '{"senderId":123456,"receiverId":123456,"bookIdToSwapWith":123456,"swapType":"ByBooks/ByGenres/GiveAway/OpenForOffers","swapOffer":{"offeredBookId":123456,"offeredGenreId":123456},"askForGiveaway":true,"note":"I want this book, how can I get it?"}'
Request examples
{
"senderId": 123456,
"receiverId": 123456,
"bookIdToSwapWith": 123456,
"swapType": "ByBooks/ByGenres/GiveAway/OpenForOffers",
"swapOffer": {
"offeredBookId": 123456,
"offeredGenreId": 123456
},
"askForGiveaway": true,
"note": "I want this book, how can I get it?"
}
Response examples (401)
{
"error": {
"code": "string",
"message": "string",
"target": "string",
"details": [
{
"code": "string",
"message": "string",
"target": "string"
}
]
}
}
Response examples (404)
{
"error": {
"code": "string",
"message": "string",
"target": "string",
"details": [
{
"code": "string",
"message": "string",
"target": "string"
}
]
}
}
Response examples (500)
{
"error": {
"code": "string",
"message": "string",
"target": "string",
"details": [
{
"code": "string",
"message": "string",
"target": "string"
}
]
}
}
Response examples (400)
{
"error": {
"code": "string",
"message": "string",
"target": "string",
"details": [
{
"code": "string",
"message": "string",
"target": "string"
}
]
}
}
Response examples (200)
{
"id": "string",
"senderId": "string",
"receiverId": "string",
"bookToSwapWith": {
"id": "string",
"title": "string",
"author": "string",
"genres": [
"string"
],
"language": "string",
"description": "string",
"condition": "string",
"coverPhotoUrls": [
"string"
],
"owner": {
"id": "string",
"name": "string"
},
"swapCondition": {
"swapType": "string",
"giveAway": true,
"openForOffers": true,
"swappableGenres": [
{
"id": "string",
"name": "string"
}
],
"swappableBooks": [
{
"id": "string",
"title": "string",
"author": "string",
"coverPhotoUrl": "string"
}
]
}
},
"swapType": "string",
"swapOffer": {
"offeredBook": {
"id": "string",
"title": "string",
"author": "string",
"coverPhotoUrl": "string"
},
"offeredGenre": {
"id": "string",
"name": "string"
}
},
"askForGiveaway": true,
"swapStatus": "string",
"note": "string",
"requestedAt": "2025-05-04T09:42:00Z",
"updatedAt": "2025-05-04T09:42:00Z"
}