Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating user specific applications and clients through the api #657

Closed
4 tasks
mschipperheyn opened this issue May 25, 2024 · 3 comments
Closed
4 tasks
Labels
question Further information is requested

Comments

@mschipperheyn
Copy link

Have you read the documentation?

  • [x ] Yes, but it does not include related information regarding my question.
  • Yes, but the steps described in the documentation do not work on my machine.
  • Yes, but I am having difficulty understanding it and want clarification.

You are setting up gotify in

  • [ x] Docker
  • Linux native platform
  • Windows native platform

Describe your problem
My objective is to use Gotify in a multi tenant system where each tenant needs to has its own sandbox of a single application and client and a stream for the website with only messages for that tenant

From the discussions here and here, I now understand that applications and client are scoped to a user. So, creating a user and then creating apps and clients with that user would be the ticket. However, I have to do all of this using the api. And I don't see an obvious way to create a user and then create an application and client as that user.

Is there a way to do this?

@mschipperheyn mschipperheyn added the question Further information is requested label May 25, 2024
@jmattheis
Copy link
Member

Have you seen the APIs listed here? https://gotify.net/api-docs

@mschipperheyn
Copy link
Author

I have. I can see how I can create an app, a user, a client and a message. But how do I create a user and then an app as that user just by using the API? I don't see a way to authenticate as the created user through the api? Perhaps I'm missing something. But I'm looking to do all this with zero use of the UI

@jmattheis
Copy link
Member

jmattheis commented May 25, 2024

Create a new user with name and pass, and then use the name and pass to create the application.

ADMIN_CREDS=admin:admin

NEW_NAME=myuser
NEW_PASS=mypass

curl -u "$ADMIN_CREDS" -F "name=$NEW_NAME" -F "pass=$NEW_PASS" 'http://localhost:8080/user'

APP_TOKEN=$(curl -u "$NEW_NAME:$NEW_PASS" -F 'name=newapp' 'http://localhost:8080/application' | jq -r '.token')

echo created app with token "$APP_TOKEN"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

2 participants