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

Adding channels via the admin API fails. #134

Closed
Leppunen opened this issue Nov 22, 2021 · 5 comments
Closed

Adding channels via the admin API fails. #134

Leppunen opened this issue Nov 22, 2021 · 5 comments

Comments

@Leppunen
Copy link
Contributor

When using the POST endpoint to add a channel to justlog, it gives me a response that the given channel was successfully joined, but the config gets appended with the target username instead of the userid, and this can be also repeated to keep appending the same name to the config file over and over again.

My guess is that the expected behaviour is to convert the given name to a ID and then append it to the config after checking it isn't already in the list of channel IDs.

When feeding a userID to the endpoint, i receive a 400 with the following error: ANYWAYS: json: cannot unmarshal object into Go struct field channelConfigsJoinRequest.channels of type string

@gempir
Copy link
Owner

gempir commented Nov 23, 2021

With #135 merged the duplication issue is gone. The endpoint only accepts userids. Not sure what your request was like but looks to be working correctly to me.

curl --request POST \
  --url http://localhost:8025/admin/channels \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: xd' \
  --data '{
	"channels": [
		"77829817",
		"128856353"
	]
}'

gempir added a commit that referenced this issue Nov 23, 2021
fix duplication of userids on config when added via api #134
@Leppunen
Copy link
Contributor Author

I think i sent the userIDs as numbers instead of strings so that could be the issue. But if you send it a username instead of a id it happily accepts it and appends the name into the config aswell. That sounds like unexpected behaviour to me. for example if you give it "forsen" instead of "22484632"

@gempir
Copy link
Owner

gempir commented Nov 23, 2021

Yeah I mean in theory that could be a valid userid since twitch specifically said userids are strings. I could make a helix call but it makes it more complicated

@gempir
Copy link
Owner

gempir commented Nov 23, 2021

Also this gives you the option to add banned users which might get unbanned in the future, so I'd rather keep it simple and expect the caller to be smart with what it submits to the API

@Leppunen
Copy link
Contributor Author

I added some sanity checks on my side, so this should be okay for now. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants