I am designing a new API and I am in doubt should it be a single API or should it be divided to end user type.
For example I have the following classes
OrderClass
ProductClass
BuyerClass
SupplierClass
And want to create API that would allow buyers and suppliers to access it
Do I create a single API such as
CompanyAPI that uses access tokens (defining roles and types)
/api/order/orderAction [allowed for buyers, suppliers]
/api/order/orderAction2 [allowed for buyers]
/api/order/orderAction3 [allowed for suppliers]
/api/buyer/buyerAction [allowed for buyers, suppliers]
/api/supplier/supplierAction [allowed for suppliers]
/api/product/productAction [allowed for buyers, suppliers]
or two APIs that are designed to fit Buyers OR Supplier needs?
BuyersAPI
/BuyersAPI/order/orderAction
/BuyersAPI/order/orderAction2
/BuyersAPI/buyer/buyerAction
/BuyersAPI/product/productAction
SuppliersAPI
/SuppliersAPI/order/orderAction
/SuppliersAPI/order/orderAction3
/SuppliersAPI/supplier/supplierAction
/SuppliersAPI/product/productAction
One of the main reason to use two APIs is documentation, and it seems logical that I wouldn't want buyer to see what information is supplier getting (at least a structure of it).
On the other hand having two APIs would mean that some parts would/could be repeated/duplicated.