# Plex API Related Question

**URL:** <https://forums.plex.tv/t/plex-api-related-question/109774>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [July 30, 2015, 7:42pm UTC](https://forums.plex.tv/t/plex-api-related-question/109774 "2015-07-30T19:42:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giga-Rapid](https://avatars.discourse-cdn.com/v4/letter/g/ed8c4c/32.png) [@Giga-Rapid](https://forums.plex.tv/u/Giga-Rapid)\
**Post date:** [July 30, 2015, 7:42pm UTC](https://forums.plex.tv/t/plex-api-related-question/109774/1 "2015-07-30T19:42:24Z")

</div>

Hello,  
I just Got my Plex Pass.  
What I am trying To do is Controlling Plex Server with its API.  
I need to make Plex Libraries with Some Folders ,  
and Invite Users [using there Plex username or email] assigning them to some libraries only.

I need to do these via API request to my plex server .  
Please Someone Tell me API URLS and Parameters for that.

thanks

---

<div class="post-metadata">

**Author:** ![reallistic](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/reallistic/32/5677_2.png) [@reallistic](https://forums.plex.tv/u/reallistic)\
**Post date:** [July 30, 2015, 8:09pm UTC](https://forums.plex.tv/t/plex-api-related-question/109774/2 "2015-07-30T20:09:26Z")

</div>

Hello,  
Your best bet would be to listen in on your plex server’s api calls via chrome/firefox/safari development tools or a program like [fiddler](http://www.telerik.com/fiddler "telerik.com/fiddler") while browsing [plex.tv](http://plex.tv) to see what requests are made.

This is a great way to find all the interesting calls that plex makes to your server.

---

<div class="post-metadata">

**Author:** ![Arcanemagus](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/arcanemagus/32/81844_2.png) [@Arcanemagus](https://forums.plex.tv/u/Arcanemagus)\
**Post date:** [July 30, 2015, 8:14pm UTC](https://forums.plex.tv/t/plex-api-related-question/109774/3 "2015-07-30T20:14:42Z")

</div>

Have you tried looking over the [unoficial API documentation](https://github.com/Arcanemagus/plex-api/wiki/Plex-Web-API-Overview)?

There isn’t too much there about adding sections like you are talking about, but somebody discovered a way to delete them. You can probably just log traffic from the web browser when doing it from there and figure it out from that. If you discover anything new please update the Wiki!

---

<div class="post-metadata">

**Author:** ![Giga-Rapid](https://avatars.discourse-cdn.com/v4/letter/g/ed8c4c/32.png) [@Giga-Rapid](https://forums.plex.tv/u/Giga-Rapid)\
**Post date:** [July 30, 2015, 8:38pm UTC](https://forums.plex.tv/t/plex-api-related-question/109774/4 "2015-07-30T20:38:08Z")

</div>

I tried but it gives

\<?xml version="1.0" encoding="UTF-8"?\>

---

<div class="post-metadata">

**Author:** ![Arcanemagus](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/arcanemagus/32/81844_2.png) [@Arcanemagus](https://forums.plex.tv/u/Arcanemagus)\
**Post date:** [July 30, 2015, 10:36pm UTC](https://forums.plex.tv/t/plex-api-related-question/109774/5 "2015-07-30T22:36:00Z")

</div>

Tried what exactly? That’s the header for an XML response but you never said what triggered it (or if there was more).

---

<div class="post-metadata">

**Author:** ![Giga-Rapid](https://avatars.discourse-cdn.com/v4/letter/g/ed8c4c/32.png) [@Giga-Rapid](https://forums.plex.tv/u/Giga-Rapid)\
**Post date:** [July 31, 2015, 8:46am UTC](https://forums.plex.tv/t/plex-api-related-question/109774/6 "2015-07-31T08:46:42Z")

</div>

yes, here is the request headers.

```
POST https://plex.tv/api/servers/8b1bb89cdb8b6c20d48478fa07aa2da8ss856987/shared_servers HTTP/1.1
Host: plex.tv
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:37.0) Gecko/20100101 Firefox/37.0
Accept: text/plain, */*; q=0.01
Accept-Language: en
Accept-Encoding: gzip, deflate
DNT: 1
Content-Type: application/json; charset=UTF-8
X-Plex-Product: Plex Web
X-Plex-Version: 2.4.16
X-Plex-Client-Identifier: fc2d02d1-2e5a-4b03-93ee-d415f28c1cd0
X-Plex-Platform: Firefox
X-Plex-Platform-Version: 37.0
X-Plex-Device: Windows
X-Plex-Device-Name: Plex Web (Firefox)
X-Plex-Username: "your Username"
X-Plex-Token: "the Token"
Referer: http://app.plex.tv/web/app
Content-Length: 170
Origin: http://app.plex.tv
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

{"server_id":"8b1bb89cdb8b6c20d48478fa07aa2da8ss856987","shared_server":{"library_section_ids":[14577512],"invited_email":"test@gmail.com"},"sharing_settings":{}}

```

this is what that gets sent when I invite someone,I simple grabbed this raw headers and pasted it on “POSTMAN” Chrome Plugin which then asked me to login to my plex account,but it gives error of

```
<?xml version="1.0" encoding="UTF-8"?>
    <Response code="400" status="Missing required parameter: shared_server"/>
```

---

<div class="post-metadata">

**Author:** ![Giga-Rapid](https://avatars.discourse-cdn.com/v4/letter/g/ed8c4c/32.png) [@Giga-Rapid](https://forums.plex.tv/u/Giga-Rapid)\
**Post date:** [July 31, 2015, 8:49am UTC](https://forums.plex.tv/t/plex-api-related-question/109774/7 "2015-07-31T08:49:03Z")

</div>

So , I was looking if anyone have already an solution

---

<div class="post-metadata">

**Author:** ![Giga-Rapid](https://avatars.discourse-cdn.com/v4/letter/g/ed8c4c/32.png) [@Giga-Rapid](https://forums.plex.tv/u/Giga-Rapid)\
**Post date:** [July 31, 2015, 9:40am UTC](https://forums.plex.tv/t/plex-api-related-question/109774/8 "2015-07-31T09:40:03Z")

</div>

Before this Request Plex sends another request

```
OPTIONS https://plex.tv/api/servers/8b1bb89cdb8b6c20d48478fa07aa2da8ss856987/shared_servers HTTP/1.1
Host: plex.tv
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:37.0) Gecko/20100101 Firefox/37.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Origin: http://11.11.255.11:32400
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type,x-plex-client-identifier,x-plex-device,x-plex-device-name,x-plex-platform,x-plex-platform-version,x-plex-product,x-plex-token,x-plex-username,x-plex-version
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

```

But response of this request is neither JSON nor XML.

Update,  
The Plex.js have all request method but i am not Js expert ,and its too large 70k lines of code,hard to figure out .

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [January 8, 2020, 7:50pm UTC](https://forums.plex.tv/t/plex-api-related-question/109774/9 "2020-01-08T19:50:22Z")

</div>


