msmcpeake 8 Posted March 25, 2020 Posted March 25, 2020 Hello, I am trying to automate the creation of accounts and adding their Emby ID from a form. What is the proper way of sending an invite from my server via a link/API call? I cannot find great documentation about this. I would like to be walked through it if possible. Thanks!
rechigo 364 Posted March 25, 2020 Posted March 25, 2020 (edited) Make a post request to this URL: http://<address>:<port>/emby/Users/<userid>/Connect/Link with a content type of application/json In the json body, you want to add a ConnectUsername property, which will contain the username/email of the connect account you wish to link (this also needs the X-Emby-Token header containing an emby api key otherwise the request will fail) Let me know if you need anymore help, this is just a brief explanation Edited March 25, 2020 by rechigo
rechigo 364 Posted March 25, 2020 Posted March 25, 2020 This is how it would look if you wanted to call it using cURL: curl -X POST -d "{\"ConnectUsername\":\"<yourconnectusername>\"}" -H "X-Emby-Token:<yourapikey>" -H "Content-Type:application/json" http://<address>:<port>/emby/Users/<userid>/Connect/Link 1
msmcpeake 8 Posted March 25, 2020 Author Posted March 25, 2020 This is how it would look if you wanted to call it using cURL: curl -X POST -d "{\"ConnectUsername\":\"<yourconnectusername>\"}" -H "X-Emby-Token:<yourapikey>" -H "Content-Type:application/json" http://<address>:<port>/emby/Users/<userid>/Connect/Link This is the error I receive: curl -X POST -d "{\"ConnectUsername\":\"msmcpeake\"}" -H "X-Emby-Token:<redacted>" -H "Content-Type:application/json" http://<redacted>:8096/emby/Users/msmcpeake/Connect/Link Input string was not in a correct format.
rechigo 364 Posted March 25, 2020 Posted March 25, 2020 (edited) This is the error I receive: curl -X POST -d "{\"ConnectUsername\":\"msmcpeake\"}" -H "X-Emby-Token:<redacted>" -H "Content-Type:application/json" http://<redacted>:8096/emby/Users/msmcpeake/Connect/Link Input string was not in a correct format. you can't use your username, you have to use your user id Edited March 25, 2020 by rechigo
msmcpeake 8 Posted March 26, 2020 Author Posted March 26, 2020 (edited) Just for anyone struggling in the future, this is my PHP CURL configuration. Just figured this all out thanks to rechigo I passed Username from a form on a web page (the variable $name), then created a user on Emby from that variable. I then got the output from curl and got the user Id ($userid), and put the two together to link Emby Connect to the user! $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, '<server ip>:8096/emby/Users/New?api_key=<api key>'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"Name\":\"{$name}\"}"); $headers = array(); $headers[] = 'Accept: application/json'; $headers[] = 'Content-Type: application/json'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); $json = json_decode($result, true); $userid = $json['Id']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "<server ip>:8096/emby/Users/{$userid}/Connect/Link?api_key=<api key>"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"ConnectUsername\":\"{$name}\"}"); $headers = array(); $headers[] = 'Accept: application/json'; $headers[] = 'Content-Type: application/json'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result2 = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); Edited March 26, 2020 by msmcpeake
maxt.v 10 Posted July 10, 2020 Posted July 10, 2020 Hi, do you know how to work with the PIN ? I don't understand how it works neither manually or by API
Luke 42083 Posted July 16, 2020 Posted July 16, 2020 On 7/10/2020 at 3:38 AM, maxt.v said: Hi, do you know how to work with the PIN ? I don't understand how it works neither manually or by API hi @maxt.v what exactly are you trying to do?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now