improve http api
- Dominant language
- Go
- Stars
- 17.1k
- Forks
- 3.2k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 11
Description
the http api is weird - already had a short conversation about this in the chat - but I think it is better to put this in an issue.
ping currently returns:
```
⋊> ~ curl http://127.0.0.1:5001/api/v0/ping/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ 20:11:57
{"Success":false,"Time":0,"Text":"PING QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ."}
{"Success":true,"Time":745266337,"Text":""}
{"Success":true,"Time":1375473326,"Text":""}
{"Success":true,"Time":230373161,"Text":""}
{"Success":true,"Time":337280582,"Text":""}
{"Success":true,"Time":220376323,"Text":""}
{"Success":true,"Time":928059102,"Text":""}
{"Success":true,"Time":2793408162,"Text":""}
{"Success":true,"Time":1162895192,"Text":""}
{"Success":true,"Time":403357018,"Text":""}
{"Success":true,"Time":1845389336,"Text":""}
{"Success":false,"Time":0,"Text":"Average latency: 1004.19ms"}
```
would be great if it returns just one json-object
swarm/peers currently returns
```
⋊> ~ curl http://127.0.0.1:5001/api/v0/swarm/peers 20:12:13
{"Strings":["/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ","/ip4/104.155.108.198/tcp/4001/ipfs/QmPTv1iPJVRmN4rpBfExHcFKCrGH3W36kbstidWsxhCqL9","/ip4/104.168.165.201/tcp/4001/ipfs/Qmabn7SBBfdNQ1oz6GMhaqpu3iA2Z8ymtnbz8iRTxwz4yf","/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx","/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z","/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM","/ip4/104.236.32.22/tcp/4001/ipfs/QmepsDPxWtLDuKvEoafkpJxGij4kMax11uTH7WnKqD25Dq"]}
```
better replace Strings withPeers or just the array without the container
```
⋊> ~ curl "http://127.0.0.1:5001/api/v0/refs/local" 20:44:30
QmNza5PEZ6oxqHNqyrNaCr3ExYU3DWsAqwhewNZ1ieuNGe
QmPFDyWdL6yjz92jdc6bzWXHKVvydAhgTzhefSmmkDXzSZ
QmPLJFteJYPXvF7g4dANY6gSgH6Cag1affR3YxuoKTvh91
QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB
QmRgiVzNguvAYcNeDJSymMKUdfW8J3HRKHzM9hPhMFqoVw
QmS7wsF77dKWdStTBv8uqwyEUbzAzANArvsAkJ7bPzzVus
QmSEbwQ8nE1ERTJnV2zydcefcPJsNNWD83uj2euWcwzoZz
QmTumTjvcYCAvRRwQ8sDRxh8ezmrcr88YFU7iYNroGGTBZ
QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
QmUzLxaXnM8RYCPEqLDX5foToi5aNZHqfYr285w2BKhkft
QmVUr1TPALJz5W7HwFi8yLwSJxTVjdwD95WcdkwZP4MMSh
QmVtU7ths96fMgZ8YSZAbKghyieq7AjxNdcqyVzxTt3qVe
QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7
QmYTFEAfxC5hQxJ8PivTmcNokRmm3UNsDoDja6CPAqp1Tt
QmYYohSgQ4CAZnPeVxBetkbPNJ9k1rRLJpugsMHQ9j61Pm
QmYhpiVpT2oZTecuTtaFfj5fdbZKHXwjHJ9QLPrGWD9seX
QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG
```
this could use some json wrapping
---
```
⋊> ~ curl "http://127.0.0.1:5001/api/v0/repo/gc" 21:13:49
{"Key":"QmPLJFteJYPXvF7g4dANY6gSgH6Cag1affR3YxuoKTvh91"}
{"Key":"QmRgiVzNguvAYcNeDJSymMKUdfW8J3HRKHzM9hPhMFqoVw"}
{"Key":"QmS7wsF77dKWdStTBv8uqwyEUbzAzANArvsAkJ7bPzzVus"}
{"Key":"QmSEbwQ8nE1ERTJnV2zydcefcPJsNNWD83uj2euWcwzoZz"}
{"Key":"QmUzLxaXnM8RYCPEqLDX5foToi5aNZHqfYr285w2BKhkft"}
{"Key":"QmVUr1TPALJz5W7HwFi8yLwSJxTVjdwD95WcdkwZP4MMSh"}
```
could be just a string array
---
```
⋊> ~ curl "http://127.0.0.1:5001/api/v0/pin/ls"
{"Keys":{"foo":{"Type":"recursive"} ..
```
the Keys is a bit weird - I think Pins would be better
Contributor guide
Assessment
This issue has not been assessed yet.