From f32767e39e3c2c74a528cb72ceadb249b2172883 Mon Sep 17 00:00:00 2001 From: Marco Dickert Date: Wed, 28 Mar 2018 08:19:22 +0200 Subject: [PATCH] Created CLI, Automatization and Cronjobs (markdown) --- CLI,-Automatization-and-Cronjobs.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 CLI,-Automatization-and-Cronjobs.md diff --git a/CLI,-Automatization-and-Cronjobs.md b/CLI,-Automatization-and-Cronjobs.md new file mode 100644 index 0000000..f153c83 --- /dev/null +++ b/CLI,-Automatization-and-Cronjobs.md @@ -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=" ... +``` \ No newline at end of file