Displaying image from REST API by Movie Title

Hello

I'm almost done with the web development course but I would like also to add the image of the movie (poster) in the Movies screen. 

I have added a column to the left and inserted a Picture widget with the goal of consuming the REST API base URL + ? + poster_path. I have copied the URL from the Movie Detail Screen (where the picture is already being well displayed by movie title), but somehow it does not work for the homepage (Movies) - the first movie poster appears in all the lines after publishing. This means that it is just assuming the first row...





The Picture at the Movies screen widget looks like this:





Can someone advise how could I correct this?


Kind Regards,

JG 

João Gomes wrote:

Hello

I'm almost done with the web development course but I would like also to add the image of the movie (poster) in the Movies screen. 

I have added a column to the left and inserted a Picture widget with the goal of consuming the REST API base URL + ? + poster_path. I have copied the URL from the Movie Detail Screen (where the picture is already being well displayed by movie title), but somehow it does not work for the homepage (Movies) - the first movie poster appears in all the lines after publishing. This means that it is just assuming the first row...





The Picture at the Movies screen widget looks like this:





Can someone advise how could I correct this?


Kind Regards,

JG 

Hello João Gomes,

Can you please share your oml file with us. Just need to debug it.


Afaque Shaikh wrote:

João Gomes wrote:

Hello

I'm almost done with the web development course but I would like also to add the image of the movie (poster) in the Movies screen. 

I have added a column to the left and inserted a Picture widget with the goal of consuming the REST API base URL + ? + poster_path. I have copied the URL from the Movie Detail Screen (where the picture is already being well displayed by movie title), but somehow it does not work for the homepage (Movies) - the first movie poster appears in all the lines after publishing. This means that it is just assuming the first row...





The Picture at the Movies screen widget looks like this:





Can someone advise how could I correct this?


Kind Regards,

JG 

Hello João Gomes,

Can you please share your oml file with us. Just need to debug it.



Here you have the OML file attached


Hi João.

Instead of 

Site.TheMovieDB_BaseURL + GetMovieInfo.Response.Results.Current.Poster_path

Try

Site.TheMovieDB_BaseURL + GetMovieInfo(Site.TheMovieDB_APIKey,MovieTable.List.Current.Movie.Title)

You are calling the first of the list of results, when you should be calling the film on the current table row.

And you are calling the API only once when you should call it once for each movie.

Hi João,

In addition to what Nuno said, I think you need a few extra steps in order to get it to work.

  • You need to create a wrapper action around the GetMovieInfo REST API Method. You can use the same type of input parameters for it (just copy/paste them from the REST method) and set the function property to Yes.

  • After that set you can set the Image URL to the following value (since GetMovieInfoWrapper is a function now we can call the REST API directly from the Image URL property):
Site.TheMovieDB_BaseURL + GetMovieInfoWrapper(Site.TheMovieDB_APIKey,MovieTable.List.Current.Movie.Title).Results.Current.Poster_path

That should get it to work.

Regards,

Nordin

Thank you all, I analyzed your inputs and ended up adding a new column on the aggregate, added a random formula just to have the string, than on the preparation added a what is shown below, and on the picture URL put the following and it worked:


João Gomes wrote:

Thank you all, I analyzed your inputs and ended up adding a new column on the aggregate, added a random formula just to have the string, than on the preparation added a what is shown below, and on the picture URL put the following and it worked:


Your Welcome!!

Happy to help :)