json dependend on each other How can I make this work

Hello, 


I have asked before but did not  get a good answer so I try again.

I have to consume 2 seperate api calls like this :  

1) Call to : "https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True"


here I got a json responds where I need to get out the 10 objectNumbers. 


2) Call to : "https\://www.rijksmuseum.nl/api/nl/collection/NUMBER?key=14OGzuak&format=json"


here the Number is the ObjectNumber of 1 out of 10 objectNumbers. 


How can I use the 1 objectNumber out of the 10 from the first json respons. 




Hi,

I would do this way:

  1. consume list webservice, fetch a list of objects
  2. define detail webservice so that its URL is https://www.rijksmuseum.nl/api/nl/collection/{NUMBER}?key=14OGzuak&format=json, this way when requesting for details you'll have to provide a NUMBER parameter which value you can get from previous request.

To actually get just 1 number out of 10 you can access it as Response.ArtObjects.Current.ObjectNumber and pass it to the detail service as a parameter

oke, and to get all 10 I could make a loop ? 

hmm, but how do I store then the 10 objectNumbers. 

make a list of strings ?? 


Roelof Wobben wrote:

oke, and to get all 10 I could make a loop ? 

hmm, but how do I store then the 10 objectNumbers. 

make a list of strings ?? 


That's up to you. Dunno if the webservice also can consume multiple object number at the same time.

I am a bit confused where your problem really lies. 


Roelof Wobben wrote:

oke, and to get all 10 I could make a loop ? 

hmm, but how do I store then the 10 objectNumbers. 

make a list of strings ?? 


Easiest is to make a foreach loop over Response.ArtObjects and access current ObjectNumber the same way as described above.

If you need to store ObjectNumbers you could have a list of strings and do a ListAppendAll() from Response.ArtObjects to that list with mappings.

To store all ArtObjects details you would need to create a list of ArtObjects and do a ListAppend() on each loop iteration.


Can you help me one more time I still fail to see how to add things to a list. 


Roelof

Solution

Roelof Wobben wrote:

Can you help me one more time I still fail to see how to add things to a list. 

See attached module. Not sure what you wanted to achieve of course.

Also had to tweak structures for API calls because not all birth/death dates are correct date format.

Hope this helps

Solution