dimanche 21 août 2022

API Search Protocol, single or multilist on attribute ids

We are doing an attribute search on Products, and creating a search API.

The Product API, has attributes in its Request including VendorId (who sell the product), and LocationId (of where its sold). Below, is it best to make Vendor and LocationId an Array , instead of single? The front end search only allows single select dropdown. However what is best API practice of back end, to make it multiid search, in case of future requirements? I don't want to couple back end with front end.

public class GetProductRequest {
    private String productName;
    private Integer locationId;
    private Integer providerId;

    private String sortField = "ProductName,desc";
    private int pageNumber = 0;
    private int pageSize = 10;
}

Aucun commentaire:

Enregistrer un commentaire