1
0
mirror of https://github.com/misterunknown/ifm.git synced 2025-08-10 18:14:00 +02:00

Created CLI, Automatization and Cronjobs (markdown)

Marco Dickert
2018-03-28 08:19:22 +02:00
parent 0ff30d63c3
commit f32767e39e

@@ -0,0 +1,14 @@
You can use the IFM API to automatically download or upload files, e.g. with curl:
```bash
$ curl "https://ifmdemo.misterunknown.de/ifm.php" -X POST -F "api=upload" -F "dir=" -F "file=@path/to/local/file"
{"status":"OK","message":"File successfully uploaded.","cd":""}
```
At the moment there is no complete API specification available, so you have to read the code to perform such calls, or just write me an email.
## autorization
If you want to use the API with curl and want to use authentication, you can do this by passing the `X-IFM-AUTH` header. This header is constructed like the widely known basic authorization header. Just join username and password with a colon and do a base64 encode:
```bash
$ echo -e "username:password" | base64
dXNlcm5hbWU6cGFzc3dvcmQ=
$ curl -H "X-IFM-Auth: dXNlcm5hbWU6cGFzc3dvcmQ=" ...
```