Ombi API for requesting items not working

Created on 12 Apr 2018  路  21Comments  路  Source: tidusjar/Ombi

Ombi build Version:

V 3.0.3174

Update Branch:

Open Beta

Media Sever:

Plex

Media Server Version:

Operating System:

Ubuntu

Ombi Applicable Logs (from /logs/ directory or the Admin page):


nothing pertaining to this in logs.

Problem Description:

Whenever I try an make an API call to POST:
/api/v1/Request/movie or /api/v1/Request/tv

I get the error:

{"error":"Object reference not set to an instance of an object."}

For movies I send data in body like so:

array('theMovieDbId' => $id);

and for TV i send like so:

array('tvDbId' => $id);
````

I can connect to the api fine with calls that approve/deny/available/unavailable etc....

One thing i did notice is if I change either `theMovieDbId` or `tvDbId` to anything else I get the generic error of : 

{"result":false,"message":"There was an issue adding this movie!","isError":true,"errorMessage":"Please try again later"}
```

Reproduction Steps:

Please include any steps to reproduce the issue, this the request that is causing the problem etc.

bug / issue

All 21 comments

example ids?

hey @tidusjar

Movie: 447332, 97, 333339
TV: 1418, 1668, 61599

You need to use capital M for Movie and capital T for Tv. Just tried it and it works.

so example /api/v1/Request/Movie

I didn't think the casing mattered. I hope it doesn't.

http://usenet.home.lab:5000/api/v1/Request/Movie with ID 97 resulted in same error...
http://usenet.home.lab:5000/api/v1/Request/Tv with ID 1668 also same error

Do you have baseurl setup? That's the only other thing I can think of...

just added it now and same error, don't think it would be that as all other calls are fine.

So this was my request header:
POST /request/api/v1/Request/Movie HTTP/1.1 Host: localhost:5000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0 Accept: application/json, text/plain, */* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Cache-Control: no-cache Connection: keep-alive Content-Length: 23 Content-Type: application/json DNT: 1 Pragma: no-cache

This is my request body:
{"theMovieDbId":333339}

This was my response:
{"result":true,"message":"Ready Player One (2018) has been successfully added!","isError":false,"errorMessage":null}

Not sure if that helps you in anyway, wonder why you are getting that issue...

$headers = array(
            "Accept" => "application/json",
            "Content-Type" => "application/json",
            "Apikey" => $GLOBALS['ombiToken']
        );

@anojht

I wonder if i cant use the API key for this function and it needs to use the JWT, does this function parse the token for user, etc?

for that request, what user does it display for who requested it?

I was logged in as admin and it display username and alias as admin

userid is the token

That's what it is then, you cannot use API key with this.

yes it seems you need to use JWT token...

yup, just tried it with token :(

Ok I'll fix that then. Thanks for narrowing it down guys.

np, i think we may have issue if you allow API, it wont know what user etc unless we either send some info you need or you use a generic name or something.

P.S. I got it to work with JWT:

image

EDIT: Scratch that - i had a typo tvdDbId

another update:

Like i said i could get movies to work but tv doesnt work at all:

[add] => Array
                (
                    [tvdDbId] => 336261
                    [requestAll] => 1
                    [latestSeason] => 1
                    [firstSeason] => 1
                )

that is my payload, in the logs this comes up:

2018-04-12 19:07:28.359 -07:00 [Error] StatusCode: BadRequest, Reason: Bad Request, RequestUri: http://api.tvmaze.com/lookup/shows?thetvdb=0

@causefx just tried this also, for the seasons you want to request it has to be true/false parameters and also when you do requestAll it seems the body is populated where only the requestAll is true and the rest are set to false.

My request headers:
POST /request/api/v1/Request/Tv/ HTTP/1.1 Host: localhost:5000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0 Accept: application/json, text/plain, */* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Cache-Control: no-cache Connection: keep-alive Content-Length: 76 Content-Type: application/json DNT: 1 Pragma: no-cache Referer: http://localhost:5000/request/search

My request body:
{"firstSeason":false,"latestSeason":false,"requestAll":true,"tvDbId":336261}

My response:
{"result":true,"message":null,"isError":false,"errorMessage":null}

Fixed in develop

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EricHupp picture EricHupp  路  4Comments

leram84 picture leram84  路  5Comments

douglasparker picture douglasparker  路  5Comments

tidusjar picture tidusjar  路  5Comments

ThePaulMichaels picture ThePaulMichaels  路  4Comments