-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Expose read-only API via Gateway #1322
Comments
I think exposing a subset of the api would work, at the same routes as the api currently works: # api on privileged "api" server works today
http://localhost:5001/api/v0/object/get?arg=/ipfs/QmZAL3oHMQYqsV61tGvoAVtQLs1WzRe1zkkamv9qxqnDuK
# read only api should work on "read only" gateway tomorrow
http://localhost:8080/api/v0/object/get?arg=/ipfs/QmZAL3oHMQYqsV61tGvoAVtQLs1WzRe1zkkamv9qxqnDuK (i dont like the |
Makes sense. |
I was going this route, and was going to load the tree one level at a time, but then I noticed that there are ways to get the entire DAG recursively for a given node, eg: Which returns an almost-JSON format which nonetheless has everything needed to construct the whole DAG: {
"Ref": "Qmcav25eTinMV632w9zdyXsFENDz5FCWjrMEVU7Nzy2v98 QmZs8mitpfSZM8TaFas9WaDVF77aQvb47UEPR1g1quoQq9 app.js\n",
"Err": ""
}{
"Ref": "Qmcav25eTinMV632w9zdyXsFENDz5FCWjrMEVU7Nzy2v98 QmSXq83RU9YFnxGS7N29gBqjMXTg3qHERzrfFZxKYCGknM lib\n",
"Err": ""
}{
"Ref": "QmSXq83RU9YFnxGS7N29gBqjMXTg3qHERzrfFZxKYCGknM Qmei6UeQ3LKeKUfzKLx8SRsmxVpvvWrLmZTkKapCoQnYgf d3\n",
"Err": ""
} I am now thinking of going this way in the calls from the client side dataviz ipfs/ipfs-webui#56 -- but this would mean adding the Digging around a bit more... a recursive version of {
"Hash": "Qmcav25eTinMV632w9zdyXsFENDz5FCWjrMEVU7Nzy2v98",
"Links": [
{
"Name": "app.js",
"Hash": "QmZs8mitpfSZM8TaFas9WaDVF77aQvb47UEPR1g1quoQq9",
"Size": 500
},
{
"Name": "lib",
"Hash": "QmSXq83RU9YFnxGS7N29gBqjMXTg3qHERzrfFZxKYCGknM",
"Size": 520503
}
]
} with a --recursive option, this could become: {
"Hash": "Qmcav25eTinMV632w9zdyXsFENDz5FCWjrMEVU7Nzy2v98",
"Links": [
{
"Name": "app.js",
"Hash": "QmZs8mitpfSZM8TaFas9WaDVF77aQvb47UEPR1g1quoQq9",
"Size": 500
},
{
"Name": "lib",
"Hash": "QmSXq83RU9YFnxGS7N29gBqjMXTg3qHERzrfFZxKYCGknM",
"Size": 520503,
"Links": [
{
"Name": "d3.js",
"Hash": "QmbgWP6n7wmczy9YP79FpDRUjYhyjVKjdDHTm9SS9nadZR",
"Size": 336528
}
]
}
]
} This takes the best part of the Note that this is similar to github API allowing you to get the metadata for an entire repo as a tree recursively, eg https://api.github.com/repos/ipfs/go-ipfs/git/trees/master?recursive=1 In summary, the current ideal to support client side dataviz is AFAICT: add a Interested in your take on this @jbenet. |
thanks @harlantwood i think you're spot on. the only part i worry about there is that the
|
Sure, either is fine. The |
Ah, also my viz code in progress is already parsing the current output of |
@travisperson I added this one under your name in the etherpad for the current sprint. Thanks! I am a Go noob, but happy to offer any help I can, especially on the planning and testing sides. |
Reading through this thread I'm not sure how clear the actual need of the dataviz is -- it's just one thing: for the gateway to support this call, exactly as it is currently supported by the API: |
Issue ipfs#1322 Added the ability to expose individual commands to a read-only style handler that can be used on any http interface. Added the read-only handler to the gateway.
Issue ipfs#1322 Added the ability to expose individual commands to a read-only style handler that can be used on any http interface. Added the read-only handler to the gateway. License: MIT Signed-off-by: Travis Person <travis.person@gmail.com>
@travisperson do you think you will continue work on this? If not I'll see if I can convince @jbenet or someone else to work on it... 😉 |
Closed with #1581, thanks all for your efforts. |
Context: We are creating DAG visualizations; (lots of) background info in ipfs/ipfs-webui#56.
@jbenet said in that thread:
Perfect, me too. 😄
Right now when we hit a given "directory" hash in the gateway
http://gateway.ipfs.io/ipfs/QmZAL3oHMQYqsV61tGvoAVtQLs1WzRe1zkkamv9qxqnDuK
we get an HTML directory listing, which includes:
On the command line
we get back JSON
So what we want is a way to get the JSON from the gateway, in addition to the standard HTML.
The options I can imagine:
Accept: application/json; charset=utf-8
). That is, keep serving the HTML index page by default, unless the HTTP request asks for JSON.http://gateway.ipfs.io/ipfs/QmZAL3oHMQYqsV61tGvoAVtQLs1WzRe1zkkamv9qxqnDuK.json
http://gateway.ipfs.io/object/get/QmZAL3oHMQYqsV61tGvoAVtQLs1WzRe1zkkamv9qxqnDuK
?@jbenet you seemed to be thinking something other than the Accept header (option 1 above), which is my current top choice. What method do you prefer?
The text was updated successfully, but these errors were encountered: