FreePBX modify queue using API results in 405


According to the freepbx issue #22294 (unfortunately I can’t post the link due to forum restrictions) it should be possible to modify the queue member using a PUT against admin/api/api/rest/queues/members/xyz

I’m getting a 405 - Method not allowed though when trying to add a member to the queue.

We are using FreePBX and Version 15.0.33 of the queues Module.

Does anyone have experience with this API Call or could direct us in the right direction ?

Are you using the latest version of the API and Core module?

Please show us your API request and response.

(For reference. OP is referring to this ticket:
Thank you @sholinaty for your contributions!)

I’m using the following API request:

curl --request PUT --url \
  --header 'Authorization: Bearer xyz \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --cookie PHPSESSID=dtndcfkf7i648n732dqgeg2815 \
  --data member=332


HTTP/1.1 405 Method Not Allowed
Date: Tue, 17 Aug 2021 12:00:11 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.6.40
X-Powered-By: PHP/5.6.40
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Allow: GET
Content-Length: 555
Content-Type: text/html;charset=UTF-8

        <title>Method not allowed</title>
                font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;
        <h1>Method not allowed</h1>
        <p>Method not allowed. Must be one of: <strong>GET</strong></p>

We are using API Version “REST API” and Core Version

I’ll look up the syntax needed for this api call and share it shortly. I think you might be on a lower version than this change however.

Second thought… might be a post and not a put. Will verify

I tried POST and PUT but the result is the same

from my testing:
this was introduced in QUEUES version 15.0.28:, so you should be good there.

my test uses a PUT… you’re good there…

one thing of note - your API is to HTTPS… my test was on HTTP.

Thats it!

your path is missing the /update/ before the queue ID.

Thanks but this results in a 404. What works is a GET against the url (without the /update/). This returns a json body with information about the queue

do you have any pending updates to the CORE or API modules?

yes but they only look like minor updates

Core Stable Sangoma Technologies Corporation [GPLv3+]( Online upgrade available (
PBX API Stable Sangoma Technologies Corporation [AGPLv3+]( Online upgrade available (
Asterisk API 15.0.12 Stable Sangoma Technologies Corporation [GPLv2+]( Enabled and up to date
REST API Stable Sangoma Technologies Corporation [AGPLv3]( Enabled; Not available online

Update it!

1 Like

core is only 1 minor version behind, and should be new enough to work…
pbx API is only 1 minor behind…
asterisk API is on the same one I have…

are you sure you’re on queues 15.0.33 ? that’s not a pending update?
can you go the web gui, and go to admin > Module admin
expand Queues
and take a screenshot please?

here is a curl that is working today.
im using Postman to make the requests, but it outputs the curl nicely.

curl --location --request PUT 'http://server-domain.tld/admin/api/api/rest/queues/members/999' \
--header 'Authorization: Bearer {removed my oauth2 token}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Cookie: PHPSESSID=50fe2j53po6d1i36aam5vorhd6' \
--data-urlencode 'member=5133' \
--data-urlencode 'dynmembers=142'

edit note: member and dynmembers, i had the plural backwards.

i guess thats the other question - is your API Key authorized for REST? and have you generated the oauth2 token from your api key? that error could be that your key isnt authorized to use REST

The /members/ was missing in my curl. It seems to be working now. Thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.