REST API
The API package exposes customer price records through Magento Web API. Create a Magento integration with only the resources required by the connecting system. Do not use an administrator token in a scheduled integration. The routes are protected by the Customer Price ACL resources: manage for reads, save for creates/updates and delete for deletes.
Install the package
composer require mageb2b/pricesystem-customerprice-api:*
php bin/magento setup:upgrade
php bin/magento cache:flush
Endpoints
| Method | Endpoint | Purpose |
|---|---|---|
GET |
/V1/pricesystem/customerprice/:id |
Read one record |
GET |
/V1/pricesystem/customerprice/search |
Search with Magento search criteria |
POST |
/V1/pricesystem/customerprice |
Create a record |
PUT |
/V1/pricesystem/customerprice/:id |
Update a record |
POST |
/V1/pricesystem/customerprice/savebulk |
Save several records |
DELETE |
/V1/pricesystem/customerprice/:id |
Delete one record |
DELETE |
/V1/pricesystem/customerprice/deleteByCustomerId/:customerId |
Delete records for a customer |
POST |
/V1/pricesystem/customerprice/deletebulk |
Delete several records |
Magento's search endpoint accepts standard searchCriteria query parameters. Start with a narrow filter and a small page size when synchronizing large catalogs.
Before sending a bulk request, validate customer, product, website and quantity identifiers in the source system. Bulk responses distinguish records that were saved from records that failed, so process the result instead of treating a successful HTTP request as proof that every row was stored.
When the shared API settings > Use custom API fields for sync option is enabled (under Stores > Configuration > MageB2B > Pricesystem), customer_id values in request bodies and the :customerId of deleteByCustomerId are resolved through the configured customer attribute instead of the numeric customer ID.
The shared Pricesystem REST guide covers price calculation endpoints. Those endpoints return calculated prices; the endpoints above manage customer price records.