Jump to content
View in the app

A better way to browse. Learn more.

Froxlor Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I tried to use the Froxlor API with curl but I got stuck at "Invalid request header".

This is the curl command I am trying:

curl --location --request POST 'https://MYDOMAIN/api.php' \
--header 'secret: mysecretstring' \
--header 'apikey: myapikey' \
--header 'Content-Type: application/json' \
--data-raw '{
    "command": "Froxlor.listFunctions"
}'

of course I insert the real domain and secret strings this is clear not the issue.

If I understand the code right it fails even before trying to authenticate:
https://github.com/Froxlor/Froxlor/blob/bd48fb732847c3926526335603ca2f3ba2c7c3b4/lib/Froxlor/Api/FroxlorRPC.php#L30

Any idea whats wrong with my request header?

 

EDIT:

This is a working curl command:

curl --location --request POST 'https://MYDOMAIN/api.php' \
--header 'Content-Type: application/json' \
--data-raw '{
    "header": {
        "apikey": "MYAPIKEY",
        "secret": "MYSECRET"
    },
    "body": {
        "command": "Froxlor.listFunctions"
    }
}'

 

Solved by d00p

Go to solution
  • Solution

apikey and secret are not http-header fields but part of the request body, e.g.

request = [header => [apikey => key, secret = sec], body => [command => ..., params => ...]]

  • Author

Thank you, it's working now.

I was really triggered by the word "header" :D

I added a working curl command in the original post as I am not able to add a code block into a reply?!

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.