GraphQL: is it possible to "mutate" an extension's user name


(Olivier) #1

Hello,

I would appreciate the ability to change one extension’s user name using FreePBX GraphQL or REST API.
Is it possible to do this ?
Doc [1] does not mention this possibility.

[1] https://wiki.freepbx.org/display/FPG/API

Best regards


(Matt Brooks) #2

Most of the GraphQL documentation can be found inside the FreePBX App. You can find out more about the GraphQL support in FreePBX here: https://www.freepbx.org/graphql-support-in-freepbx-15/

Unfortunately, I don’t think there is a way to update the extensions’s user name. The GraphQL library is only about 20% complete and the rest library is in the same state it seems. The userman module, where the users live, don’t look to have a GraphQL API. It DOES have a Rest API, but it looks to be read only.

The semi-good news is that device mutation look to be supported by the GraphQL library. I did pull up the code where the device is updated, but it looks like it just removes the device and creates a new one: https://git.freepbx.org/projects/FREEPBX/repos/core/browse/Api/Gql/Devices.php?at=refs%2Fheads%2Frelease%2F15.0#61-62

I will note that a device and a user in FreePBX are two different objects.

Some of the queries I played around with were:

And the Update query, but it looks to have a bug in it:


API or Command to create / update / delete extensions in freepbx
FreePBX design discussion
(TheJames) #3

Note the GraphQL and REST API are very basic. They have a ton of room for expansion. I encourage people to contribute to these and add support to more modules.


(Olivier) #4

Thanks for replying !

Just a question:
Is the above id: “6060” instead of id: “6000”, on purpose ?


(Itzik) #5

That’s probably the bug…


(Olivier) #6

Thinking back to what I was hoping to implement:

  • a userman module API (either GraphQL or REST) is needed
  • this API should allow INSERTs and UPDATEs.

Maybe, an LDAP backend can act as such, giving me the capability to create new users or edit existing ones and then “moving” an existing extension from one user to a new one …


(Matt Brooks) #7

Yeah, I agree it would be nice. I’m not sure when a developer at Sangoma will get the priority to add this functionality, but maybe someone from the community can help out here. And if anyone does have an interest in doing so, I would love to talk to them.


(Andrew Nagy) #8

User Manager already has all of this without an API.


(Olivier) #9

You can obviously create User entries in LDAP database.

My question is:
Using GraphQL or REST, can you currently dissociate one Extension from one LDAP User entry and associate it to another LDAP User ?

Being really novice in LDAP matters, I’m certain I would dive in many traps before finding a meaningful answer while building a prototype to test this.


(system) closed #10

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