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

Plex url not correct resulting in 404 #22

Open
Deff3x opened this issue Sep 4, 2024 · 4 comments
Open

Plex url not correct resulting in 404 #22

Deff3x opened this issue Sep 4, 2024 · 4 comments

Comments

@Deff3x
Copy link

Deff3x commented Sep 4, 2024

When trying to retrieve the User details for the display name using client.plex.getUserDetails() it is returning a 404 response due to a bad request url.

When instantiating I am providing the following:

const client = new PlexAPI({
  accessToken,
  xPlexClientIdentifier: uuid,
  ip: '192.168.0.53',
  port: '32400',
  protocol: 'http',
})

const test = await client.plex.getUserDetails()
console.log(test)

Results:

SDKError: API error occurred: Status 404 Content-Type application/json; charset=utf-8 Body 
{"status":404,"error":"Not Found"}
{
  rawResponse: Response {
    status: 404,
    statusText: 'Not Found',
    headers: Headers {
      date: 'Wed, 04 Sep 2024 20:49:31 GMT',
      'content-type': 'application/json; charset=utf-8',
      'transfer-encoding': 'chunked',
      connection: 'keep-alive',
      'x-request-id': '4ceb9337c8be874ded4d20c8dfa4ba32',
      'x-runtime': '0.002691',
      'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
      'referrer-policy': 'origin-when-cross-origin',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'SAMEORIGIN',
      'x-xss-protection': '1; mode=block',
      vary: 'Origin',
      'content-encoding': 'gzip'
    },
    body: ReadableStream { locked: true, state: 'closed', supportsBYOB: true },
    bodyUsed: true,
    ok: false,
    redirected: false,
    type: 'basic',
    url: 'https://plex.tv/api/v2user'
  },
  body: '{"status":404,"error":"Not Found"}',
  statusCode: 404,
  contentType: 'application/json; charset=utf-8'
}

As you can see from above the url is set to url: 'https://plex.tv/api/v2user'.

I am receiving similar results with *.plex.getUserFriends()

Fix for now is manually overriding the server url and including the ending forward slash / as follows:

const test = await client.plex.getUserDetails({
  serverURL: "https://plex.tv/api/v2/",
})
@LukeHagar
Copy link
Owner

This is hopefully fixed in the most recent set of regenerations, please let me know if otherwise

@Deff3x
Copy link
Author

Deff3x commented Sep 8, 2024

Looks like the endpoint is now working although has been moved into client.authentication.getUserDetails

I am now getting a giant error block into the console stating rawMessage: 'Response validation failed', looks like some of the models/enums don't fully line up yet.

error-dump.log

Let me know if you need any more information or if you want me to open a new issue to track.

@LukeHagar
Copy link
Owner

Thanks for confirming!

If you want to provide a sanitized version of the raw response you are getting from the API I can try to get the schemas aligned

@Deff3x
Copy link
Author

Deff3x commented Sep 14, 2024

Apologies for the delay!

Here is the JSON you asked for, I have marked {REMOVED} on anything I have sanitised.

Let me know if you need anything else!

user.json

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

No branches or pull requests

2 participants