Skip to main content

Catalog API

Service: book-service (port 8083). Covers four resource groups routed by the gateway: /api/books, /api/authors, /api/categories, /api/publishers.

Security: all catalog reads require Authorization: Bearer <token>; all writes additionally require hasRole('ADMIN'). Only /actuator/health and /actuator/info are public.


Books — /api/books

MethodPathAuthBodyResponse
POST/api/books/createADMINBookCreateRequestBookResponse (201)
PUT/api/books/update/{id}ADMINBookCreateRequestBookResponse
DELETE/api/books/{id}ADMINraw string
GET/api/books/{id}authenticatedBookResponse
POST/api/books/batchauthenticatedList<UUID>List<BookResponse>
GET/api/books/authenticatedList<BookResponse>

BookCreateRequest

FieldType
isbnstring
titlestring
descriptionstring
pricenumber (BigDecimal)
languagestring
publishedDatestring (yyyy-MM-dd)
publisherIdUUID
categoryIdUUID
authorIdsarray<UUID>

BookResponse

FieldType
idUUID
isbnstring
titlestring
descriptionstring
pricenumber
languagestring
publishedDatestring (yyyy-MM-dd)
publisherIdUUID
categoryIdUUID
authorIdsarray<UUID>

POST /api/books/create

POST /api/books/create
Authorization: Bearer <admin token>
Content-Type: application/json
{
"isbn": "978-0135957059",
"title": "The Pragmatic Programmer",
"description": "Your journey to mastery.",
"price": 39.99,
"language": "en",
"publishedDate": "2019-09-13",
"publisherId": "9a1b2c3d-4e5f-4061-8273-8495a6b7c8d9",
"categoryId": "1c2d3e4f-5061-4728-9384-95a6b7c8d9e0",
"authorIds": ["2d3e4f50-6172-4839-9405-a6b7c8d9e0f1"]
}

Response 201 Created

{
"id": "abcabc01-2345-4678-89ab-cdef01234567",
"isbn": "978-0135957059",
"title": "The Pragmatic Programmer",
"description": "Your journey to mastery.",
"price": 39.99,
"language": "en",
"publishedDate": "2019-09-13",
"publisherId": "9a1b2c3d-4e5f-4061-8273-8495a6b7c8d9",
"categoryId": "1c2d3e4f-5061-4728-9384-95a6b7c8d9e0",
"authorIds": ["2d3e4f50-6172-4839-9405-a6b7c8d9e0f1"]
}

POST /api/books/batch

Fetch many books at once — used by order-service and payment-service. The body is a raw JSON array of UUIDs, not a wrapped object.

["abcabc01-2345-4678-89ab-cdef01234567", "bcdbcd12-3456-4789-9abc-def012345678"]

Response 200 OKList<BookResponse>.

DELETE /api/books/{id}

Response 200 OK — raw string "Deleted SuccessFully".


Authors — /api/authors

MethodPathAuthResponse
POST/api/authors/createADMINAuthorResponse (201)
PUT/api/authors/update/{id}ADMINAuthorResponse
GET/api/authors/{id}authenticatedAuthorResponse
DELETE/api/authors/{id}ADMINraw string "Success"
GET/api/authors/authenticatedList<AuthorResponse>

AuthorRequest: firstName (string), lastName (string), biography (string), country (string). AuthorResponse: id (UUID) plus the same fields.

{
"firstName": "David",
"lastName": "Thomas",
"biography": "Co-author of The Pragmatic Programmer.",
"country": "US"
}

Categories — /api/categories

MethodPathAuthResponse
POST/api/categories/createADMINCategoryResponse (201)
PUT/api/categories/update/{id}ADMINCategoryResponse
GET/api/categories/{id}authenticatedCategoryResponse
DELETE/api/categories/{id}ADMINraw string "Success"
GET/api/categories/authenticatedList<CategoryResponse>

CategoryRequest: name (string), description (string). CategoryResponse: id (UUID), name, description.

{ "name": "Software Engineering", "description": "Books on building software." }

Publishers — /api/publishers

MethodPathAuthResponse
POST/api/publishers/createADMINPublisherResponse (201)
PUT/api/publishers/update/{id}ADMINPublisherResponse
GET/api/publishers/{id}authenticatedPublisherResponse
DELETE/api/publishers/{id}ADMINraw string "Success"
GET/api/publishers/authenticatedList<PublisherResponse>

PublisherRequest: name (string), address (string). PublisherResponse: id (UUID), name, address.

{ "name": "Addison-Wesley", "address": "Boston, MA" }

Book images

BookImageController is mapped at /api/bookimage but has no implemented endpoints, and the path is not included in the gateway routes. It is a placeholder for future image upload support.