22 days later

hi @maicol07, I installed the extension but I can't find it in my admin panel. Is there an extra step I need to do?

    vietoseas are you sure to have installed it correctly? Can you attach the output of composer show maicol07/flarum-ext-sso?

    a year later

    Release 1.5 (2023-05-26)

    What's Changed

    New Contributors

    Full Changelog: maicol07/flarum-api-client1.4 → 1.5

    Release 1.5.1 (2024-02-27)

    a month later

    Hi 👋

    @maicol07 Thank you for your work in creatring the Flarum API Client 👍

    I'm new in Flarum and PHP.

    I need help.

    Can you please write code examples using Flarum API Client that do:

    1. Create new user
    2. Patch/Set user groups

    I'm trying $api->users()->id(3)->patch($data);
    but patch is protected method. I don't understand how to work with your API Client to Patch/set users of create new one.

      maicol07 thank you for your help 🤝
      Create/sign + Delete works for me 👍

      I still can't figure out the update method.
      My task is to add or remove groups for users.

      I looked at your examples and wrote the following code, but it doesn't work:

      //all good
      $user = $this->api->users()->id($id)->request();
      $groups = $user->relationships['groups'];
      
      //add new group '3' to already existing
      $groups['3'] = [
          'type' => 'groups',
          'id' => '3'
      ];
      
      $res = $this->api->users($id)->patch([
          'relationships' => [
              'groups' => [
                  $groups
              ]
          ]
      ])->request();
      //Throw exception 'Uncaught Maicol07\Flarum\Api\Exceptions\UnauthorizedRequestMethodException: patch in... 
      ///vendor/maicol07/flarum-api-client/src/Fluent.php:162...'
      
      return $res;

      Sorry to bother you with a question, but I need your help 🙏

        maicol07 Oh, sorry. Thank you. My mistake and I corrected it.
        For now $res return user object. However, it is the same as it was before = the groups have not changed.

        I'm trying to delete some group like: get user groups by API -> then unset($groups['6']); -> then Patch but it does not make any changes to the user profile.
        I don't understand what I'm doing wrong.

        As an option, I see the option of directly making changes to the 'group_user' table in MySQL of Flarum database, and it seems easier for me 😂 Although not the most beautiful approach 🤔

          maicol07 Yes you are right 👍 That was the mistake. Now it works 👏
          Thank you very much for your help 🤝
          Have a nice day!

          14 days later
          11 days later

          Hello, please tell me how to use caching?

            13 days later

            kelaspajak Hi, it seems the client isn't used in the code of the thread OP

            gm-fire what do you mean by caching? The client already uses caching in some cases. If you want to cache objects with your caching system (i.e. from your framework) you can do it without issues!

            2 months later

            Hey!! From what I understand, installing this package adds a new section to my Flarum install so I can add API keys?

            Thanks!!!!

              gabrilator no, an API key is required to use the plugin in the Auth system, but you have to create one manually in the database. At the moment, this can't be done from the Admin UI

              3 months later

              My website is In laravel and i also install forum in seperate domain , Now I want to display Flarum posts iN my laravel Website Via API, is their Any step by step docs Available in laravel 11 i Install this "https://docs.maicol07.it/en/flarum-api-client" via composer in laravel project but Api not working , i create post route , a seperate controller to fetch th discusiion as you described in example , but nothing data recieved , i need support Thanks

              Merged 1 post from APi issue In laravel 11, Need step by step guide .