Get buyerv1.0.0 · JSON Schema
Returns the Buyer profile selected by identifier, subject to the caller's authorization.
1. Retrieve a Buyer Profile by ID
An admin or backoffice user fetches a Buyer’s profile and formatted shipping address by UUID (GET /api/v1/buyers/{id}).
Payload details
id: Buyer UUID.name: Buyer display name (string | null).address: Formatted shipping address (string | null).
Example response
{ "id": "01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a01", "name": "Minh Nguyen", "address": "42 Nguyen Hue Blvd, Ho Chi Minh City, Ho Chi Minh"}Using this example
Returns 200 OK with the BuyerDto JSON payload, or 404 Not Found if the Buyer does not exist.
using BookWorm.Chassis.Utilities.Configurations;using BookWorm.Constants.Aspire;using Refit;
public interface IOrderApiClient{ [Get("/api/v1/buyers/{id}")] Task<BuyerResponse> GetBuyerAsync(Guid id, CancellationToken cancellationToken = default);}
public sealed record BuyerResponse(Guid Id, string? Name, string? Address);
// DI registration following BookWorm.Chassis Refit patternbuilder.Services .AddRefitGeneratedClient<IOrderApiClient>(settings, Services.Ordering) .ConfigureHttpClient(client => client.BaseAddress = new($"https+http://{Services.Ordering}")) .ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(5) } );
// Typed invocationvar buyer = await orderApiClient.GetBuyerAsync( Guid.Parse("01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a01"), cancellationToken);import buyersApiClient from "@workspace/api-client/ordering/buyers";import useBuyer from "@workspace/api-hooks/ordering/buyers/useBuyer";
const buyerId = "01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a01";
// 1. Direct @workspace/api-client (Axios) callconst buyer = await buyersApiClient.get(buyerId);const currentBuyer = await buyersApiClient.getCurrentBuyer();
// 2. React / TanStack Query hook (@workspace/api-hooks)const { data: buyerDetail, isLoading } = useBuyer(buyerId);1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "BuyerDto",
4 "description": "Buyer profile response documented by the Ordering API OpenAPI contract.",
5 "type": "object",
6 "required": ["id", "name", "address"],
7 "properties": {
8 "id": {
9 "type": "string",
10 "format": "uuid"
11 },
12 "name": {
13 "type": ["string", "null"]
14 },
15 "address": {
16 "type": ["string", "null"]
17 }
18 }
19}
20