Try 30 days of free premium.

Cast Images are sometimes not returned properly

k_zeon wrote 2 years ago: 1

If i send query
http://api.tvmaze.com/shows/101?embed=cast
i should get information for a show and get embedded cast members.
However on the show above , i check for the following , but one cast member does not have any images.
p.Item("_embedded").Item("cast").Item(CastCount).Item("person").Item("image").Item("medium")
If i check  p.Item("_embedded").Item("cast").Item(CastCount).Item("person").Exists("image") it shill show true 

if i check p.Item("_embedded").Item("cast").Item(CastCount).Item("person").Item("image").Exists("medium") it errors out that there is no Object

I thought that p.Item("_embedded").Item("cast").Item(CastCount).Item("person").Item("image") should return info if the image contains either
.Item("medium")  OR .Item("original")  but i cannot check for this without the error.

I cannot check if Null or Exists as both will fail if there are or are not images

Pls advise if this should always return image information even it there is nothing there ie  blank data?

 

 

 

 


gazza911 wrote 2 years ago: 1

This seems like more of an issue in your implementation; CastCount isn't something which exists on that endpoint.

To answer your question though, image would be null if there is no image.

k_zeon wrote 2 years ago: 2

@gazza911 wrote:
This seems like more of an issue in your implementation; CastCount isn't something which exists on that endpoint.

To answer your question though, image would be null if there is no image.

Hi. CastCount = each castmember

so castcount = 8 ( this is the one that does not have any images) so i dont know how to check if 'medium' or 'original'  exists

p.Item("_embedded").Item("cast").Item(CastCount).Item("person").Item("image").Exists("medium") < if not image then this causes the error

if i check for p.Item("_embedded").Item("cast").Item(CastCount).Item("person").Exists("image") , even if  'medium' or 'original' are not there will be True

I dont seem to be able to figure a way to check if 'medium' or 'original' exists as i always get Object Required.

The only way i can see at the moment is to Resume on Error and skip it.?


gazza911 wrote 2 years ago: 1

You'll have to provide a bit more context, like what programming language this is.

It doesn't look like you're doing a proper null check on the value of image, but just checking that the property exists.

Try 30 days of free premium.