Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Cannot do create_invite nor send_invite via API

    Support
    invite api
    2
    6
    186
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • andres.moya
      andres.moya last edited by girish

      Hello. I've been using the API for some time to manage users in my Cloudron instance through a different application (our association members management app).

      But now I find that cannot use the "create_invite" and "send_invite" calls, to generate a link for the users to log in after creation (as explained here https://docs.cloudron.io/api.html#tag/Users/paths/~1users~1{userId}~1create_invite/post).

      The API call, even I use json format, replies with a html text like this:

      <!DOCTYPE html>
      <html lang="en">
      
      <head>
      	<meta charset="utf-8">
      	<title>Error</title>
      </head>
      
      <body>
      	<pre>Cannot POST /api/v1/users/uid-13f7fac9-131e-4452-93c3-6d7762615e8c/create_invite</pre>
      </body>
      
      </html>
      

      Sorry, no idea of what's happening here. This was working before, although I couldn't say when exactly it broke. I think the call we are making is correct.

      Any clue? Thanks.

      1 Reply Last reply Reply Quote 0
      • nebulon
        nebulon Staff last edited by

        Actually the API has changed with v7, since the whole impersonation/invite/password reset area was reworked. Sorry we haven't updated the docs yet.

        Will do this in a bit. For the meantime, essentially the routes are now:

        GET '/api/v1/users/:userId/invite_link' -> 200 { inviteLink }
        POST '/api/v1/users/:userId/send_invite_email' with body { email: 'send@invite.to' } -> 202 {}
        
        andres.moya 1 Reply Last reply Reply Quote 1
        • andres.moya
          andres.moya @nebulon last edited by

          @nebulon thanks! I've been able to do it now, with these routes.

          One question: I see that the send_invite_email has now a parameter to specify the email address to send the link. Is this mandatory? Or can I omit it, and have cloudron to use the primary email address of the user?

          nebulon 1 Reply Last reply Reply Quote 0
          • nebulon
            nebulon Staff @andres.moya last edited by

            @andres-moya currently the email is mandatory. I don't quite remember right now if this was on purpose or just because the route was implemented mainly with the dashboard in mind.

            I think it makes sense to have it optional and falling back to the user's email address then.

            Also please note, that a user now mostly only has one email and optionally a password reset email address set.

            andres.moya 1 Reply Last reply Reply Quote 0
            • andres.moya
              andres.moya @nebulon last edited by

              @nebulon All clear now. Thanks very much.

              1 Reply Last reply Reply Quote 0
              • nebulon
                nebulon Staff last edited by

                The API docs are now also updated for the invite routes.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB