I have 2 endpoints:
- enpoint A can only be called if endpoint B has been called before at least once. After endpoint B has been called, endpoint A can be called multiple times.
- endpoint B can be called multiple times without problems.
Endpoint B loads certain data that must be present in the system, before we import additional data using A. The data is different between the two endpoints, but B is needed to enrich the one that A will import.
I am currently throwing an exception in the controller of endpoint A if endpoint B has not been called before.
I would like to know if there is a best practice in REST to signal or enforce this behavior.
In case there is not, is it ok if I return 400 bad request for it or there is a more specific status code?