ygrek / mldonkey

cross-platform multi-network p2p daemon (previously at http://mldonkey.sourceforge.net/)
Other
240 stars 45 forks source link

how do use json api? #28

Closed jues1991 closed 6 years ago

jues1991 commented 6 years ago

document: https://github.com/ygrek/mldonkey/blob/api/docs/api.md I use it in the document, always 404.

ygrek commented 6 years ago

Need more information : what do you do exactly?

lulol commented 3 years ago

I never was able to get a successful reply from the api either.

$ curl -D - http://$u:$p@172.20.0.2:4080/api/1/downloads.json
HTTP/1.1 404 Not Found
Server: MLdonkey/3.1.5
Connection: close
Pragma: no-cache
Content-Type: text/html;charset=UTF-8
Content-length: 281

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>404 Not Found</title></head>
<h1>404 Not Found</h1>
The requested URL api/1/downloads.json was not found on this server.
<hr><address>MLDonkey/3.1.5 at 172.20.0.2 Port 4080</address></html></html>

Perusing the source code found some api references suggesting that are used with submit in the same way as 'q', but seems that are just the same as 'q'.

https://github.com/ygrek/mldonkey/blob/8dceb41fe71c1c040208d40d44a2104db694e125/src/networks/bittorrent/bTInteractive.ml#L499

$ curl -D - "http://$u:$p@172.20.0.2:4080/submit?api=/api/1/downloads/all/pause.json"
HTTP/1.1 200 OK
Content-length: 48

No such command /api/1/downloads/all/pause.json

The submit query works but is not as convenient.

$ curl "http://$u:$p@172.20.0.2:4080/submit?q=${command}"

ygrek commented 3 years ago

api is in the branch https://github.com/ygrek/mldonkey/tree/api it was not merged into master