On Wed, 13 Mar 2019 at 04:59, Roelof Wobben <r.wobben@home.nl> wrote:
Op 11-3-2019 om 00:03 schreef Ben Coman:
getMoreData "or a better name of your own" | url json artObjectJson | url := 'https://www.rijksmuseum.nl/api/nl/collection/' , objectNumber , '?key=[API_KEY]&format=json' Transcript crShow: 'Getting description from ', url. json := (NeoJSONReader fromString: (ZnEasy get: url) contents). artObjectJson := json at: 'artObject. description := artObjectJson at: 'description'. title := artObjectJson at: 'title'.
hello Ben,
I think I almost see what you mean but still one problem
when doing this code :
collectionUrl := ' https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=s... '. json := NeoJSONReader fromString: (ZnEasy get: collectionUrl) contents. paintings := Paintings fromJSON: json. paintings do: [:painting | painting getMoreData ]
here I see a error : instance of Paintings do not understand do:
I think we have to get the directory named paintings out of the object,
this seems to be working :
collectionUrl := ' https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=s... '. json := NeoJSONReader fromString: (ZnEasy get: collectionUrl) contents. paintings := Paintings fromJSON: json. (paintings paintings) do: [:painting | painting getMoreData ]
You are right. An alternative fix is... Paintings >> do: aBlock ^ paintings do: aBlock cheers -ben