Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Root path should return HATEOS payload #508

Closed
1 task
Mec-iS opened this issue Sep 29, 2020 · 5 comments
Closed
1 task

Root path should return HATEOS payload #508

Mec-iS opened this issue Sep 29, 2020 · 5 comments

Comments

@Mec-iS
Copy link
Contributor

Mec-iS commented Sep 29, 2020

I'm submitting a

  • bug report.
  • [ x] feature request.

Current Behaviour:

At the moment http://localhost:8080/ returns 404.

Expected Behaviour:

The root of the API should return a list of links to existing collections (see this blogpost for brief explanation of HATEOAS). For example:

{
    "links": [
        {
            "href": "http://localhost:8080/serverapi/MessageCollection",
            "rel": "http://localhost:8080/serverapi/vocab#Message",
            "type" : "GET",
            "description": "list Message items" 
        },
        ...
    ]
}
@chrizandr
Copy link
Member

chrizandr commented Sep 29, 2020

This is already done with the entry point object at http://localhost:8080/serverapi/ it would be wrong to assume that the base URI will not be used for anything else. There may be multiple APIs hosted on the same domain, with possibilities like http://localhost:8080/api1/ and http://localhost:8080/api2/ on the same domain. We treat the entry point as the main source to access the API and any information related to it. The Link header already contains the link to the entry point if that is not known.

@Mec-iS
Copy link
Contributor Author

Mec-iS commented Sep 29, 2020

Right, but /serverapi is in JSON-LD format, very verbose and hard to use (beside the fact that the IRIs there does not include the domain, see #507). It would be better from a developer experience perspective to have a plain JSON entrypoint as in the example above.

There may be multiple APIs hosted on the same domain, with possibilities like http://localhost:8080/api1/ and http://localhost:8080/api2/

in this case maybe would make more sense to have subdomains like api1.domain.com, each of which holds its own hydrus instance. Have we discussed multiple APIs somewhere? Having multiple APIs is more an infrastructure than a software feature, so it should be handled using containers (every API with its own hydrus in its own container; that would be more compliant with current standards).

@chrizandr
Copy link
Member

chrizandr commented Sep 29, 2020

It is possible to have the entry point object served at the root domain in that case.

Leaving the API Name variable as blank in hydrus will serve everything at the root domain. In case the variable is not blank, the root of the API becomes http://localhost:8080/[API Name]/.

According to the HATEOS explanation.

REST client hits an initial API URI and uses the server-provided links to dynamically discover available actions and access the resources it needs.

Incase the API name variable is not blank in hydrus the initial API URI would be http://localhost:8080/[API Name] which contains an entry point object with all links. Having a blank API Name variable would make the initial API URI as http://localhost:8080/ where we serve the entry point object.

Having a supplimentary list along with the entry point object that does not follow the hydra spec and is not in JSON-LD seems confusing. The entry point object is not verbose at all compared to the example written in the OP. The example also contains extra information about the operations supported at an endpoint that is already there in the API documentation. It seems redundant to have them in two places. Such responses also cannot be handled by a Hydra Client.

@HTTP-APIs HTTP-APIs deleted a comment from raoashish10 Jan 19, 2021
@HTTP-APIs HTTP-APIs deleted a comment from yashkhandelwal05 Jan 19, 2021
@HTTP-APIs HTTP-APIs deleted a comment from koolgax99 Jan 19, 2021
@Asmi8
Copy link

Asmi8 commented Feb 1, 2021

Is the entry point object possible in the root domain?

@Purvanshsingh
Copy link
Member

Fixed with #571 can be closed.

@Mec-iS Mec-iS closed this as completed May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants