Skip to content
Chris edited this page Nov 5, 2019 · 1 revision

Configuration

This section of the API can only be performed by users with the ADMIN permission. The only user that is automatically granted this permission is the Plex Server Owner. Any other user attempting to use the configuration endpoints will simply get an Unauthorized response.

Expectations

Every endpoint on the MediaButler Server is expected to be configurable. By querying the Version Endpoint you can obtain a list of the available endpoints loaded into the server. Expected URL structure is to be /configure/{{endpoint}} For this example we will use the tautulli endpoint.

Get Configuration

Request:

curl --location --request GET "http://127.0.0.1:9876/configure/tautulli" \
  --header "MB-Client-Identifier: 4d656446-fbe7-4545-b754-1adfb8eb554e" \
  --header "Authorization: Bearer MB_TOKEN"

Replace MB_TOKEN with the token obtained from Authentication

Response:

{
  "schema": [
    {
      "name": "url",
      "type": "url"
    },
    {
      "name": "apikey",
      "type": "secure-string"
    }
  ],
  "settings": {
    "url": "http://127.0.0.1:8181/tautulli",
    "apikey": "sdfdsfsfddgdgdfhghfghfggh"
  }
}

Test Configuration

Request:

curl --location --request PUT "http://127.0.0.1:9876/configure/tautulli" \
  --header "Content-Type: application/json" \
  --header "MB-Client-Identifier: 4d656446-fbe7-4545-b754-1adfb8eb554e" \
  --header "Authorization: Bearer MB_TOKEN" \
  --data "{
	\"url\": \"http://127.0.0.1:8181/tautulli/\",
	\"apikey\": \"sdfdsfsfddgdgdfhghfghfggh\"
}"

Response:

{
  "message": "success",
  "settings": {
    "url": "http://127.0.0.1:8181/tautulli/",
    "apikey": "sdfdsfsfddgdgdfhghfghfggh"
  }
}

Save Configuration

Request:

curl --location --request POST "http://127.0.0.1:9876/mediabutler/configure/tautulli" \
  --header "Content-Type: application/json" \
  --header "MB-Client-Identifier: 4d656446-fbe7-4545-b754-1adfb8eb554e" \
  --header "Authorization: Bearer MB_TOKEN" \
  --data "{
	\"url\": \"http://127.0.0.1:8181/tautulli\",
	\"apikey\": \"sdfdsfsfddgdgdfhghfghfggh\"
}"

Response:

{
  "message": "success",
  "settings": {
    "url": "http://127.0.0.1:8181/tautulli",
    "apikey": "sdfdsfsfddgdgdfhghfghfggh"
  }
}