Hello,

I have this code :

getMoreData
    | url url2 json json2 artObjectJson levelsJson|
    url := 'https://www.rijksmuseum.nl/api/nl/collection/' , objectNumber
        , '?key=14OGzuak&format=json'.
    url2 := 'https://www.rijksmuseum.nl/api/nl/collection/'
        , objectNumber , '/tiles?key=14OGzuak'.
    "Read the data from the api respons"
    json := NeoJSONReader fromString: (ZnEasy get: url) contents.
    artObjectJson := json at: #artObject.
    painter := ((artObjectJson at: #principalMakers) at: 1) at: #name.
    title := artObjectJson at: #title.
    "Read the imageUrl from the api respons"
    json2 := NeoJSONObject fromString: (ZnEasy get: 'https://www.rijksmuseum.nl/api/nl/collection/SK-C-1368/tiles?key=14OGzuak') contents utf8Decoded.
    levelsJson := (json2 at: #levels).
    imageUrl :=  levelsJson at: 1.

but now I see that somethimes ZnEasy get: url   gives a document of zero bytes. Now can I put the rest in a big ifFalse block or make another function for it or is there a better more smalltalk way of dealing with this "problem".

Roelof

Reply via email to