marklogic-community / grove-react-visjs-graph

Other
1 stars 4 forks source link

Define generic api between front-end and mid/back #4

Open grtjn opened 5 years ago

grtjn commented 5 years ago

We need to add OpenAPI spec for data fetched from backend to be used in the graph component. Maybe just spelling out the visjs format is enough, or maybe wrapped to allow adding some extra info. We should also spell out what requests can be sent from front-end, preferable as generic as possible as well. The format should not care about origin of the graph data, nor about what logic to use to collect the data. The backend (or middle-tier probably) should just know..

grtjn commented 5 years ago

It would be nice if the api would be embedded into the existing api somehow. One could imagine there is a /api/crud/{type}/{docid}/graph, and a /api/search/{type}/graph endpoint. The first would take the iri derived from docid as starting point, the latter would use a search to come up with the initial iris. Both could take extra params for expanding after initial call.

Note: prefer POST over GET. POST body is protected by https, and can hold more info.