I’m a little new to working with API’s and I’m just getting my head around how relationships work. I’m trying to work how out to write the correct URL for it to return a random song from a specific range of years from a specific country.
This will list all of the releases between 1964 and 1978 from Brazil. I’m struggling to work out how to achieve the same results with the API url. I don’t mind using my own code to pick a random release if there isn’t a way to do it using the API.
I was wondering if anyone would be able to guide me in the right direction and I can try and figure out the rest on my own - would appreciate the help!
Ah that looks about right. I did notice something a bit odd though. I removed the limit=25 so it returns all results, but it doesn’t seem to include this release by Milton Nascimento:
I’ve noticed it with a few others, but this one is just an example. It should meet the criteria, MusicBrainz has it down as being from country ‘br’ and release year ‘1972’, I’m not sure why the API get wouldn’t include it.
Any obvious reason why it would omit releases that should match the criteria?
EDIT: I noticed this doesn’t seem to be anything to do with the API, as the search results page also doesn’t include this album. If I specify for it to also search for the word ‘clube’ (the first word of the album name) it does include it. For example: https://musicbrainz.org/ws/2/release?query=date:[1964+TO+1978]+AND+country:br+AND+clube
No idea why it doesn’t show it in the database unless you specify part of the release name
Note that there is still a limit, 25 is the default, 100 is the maximum. If you want more results you need to do additional requests with the offset parameter.
Got it! This is making more sense now - thanks for your help. So if I wanted to work out how many times I’d need to make additional requests to offset then would I look at the release-list count. So in this example it says its 1319, so I would need to do around 13 requests to get all of the data?