I have a HATEOAS (HAL at https://example.com/api) backend and a SPA (Angular at https://example.com/spa) as frontend.
As long as all my links are within my own API and the responses are HAL, my SPA frontend knows how to display them in a UI.
But what should I return as link if I need to point to an external resource which might not even return HAL so my Frontend has no idea how to interpret it?
What about the following scenarios:
- The external resource is a JSON API which does not return HAL (e.g. https://external.com/api), but there is a frontend which knows how to interpret the resource (e.g. https://external.com/frontend). Should I return the link to the API (as all other links pointing to my own API), or should I return the link to the frontend? How should my frontend know that it cannot display these and somehow redirect the user to the external frontend?
- The external resource does not have an API, but just a frontend (e.g. https://external.com/) How should my frontend know that it cannot display this and somehow redirect the user to the external frontend?