How to request both releaseids and recordingids with a POST request

acoustid
Tags: #<Tag:0x00007fcb4bded258>

#1

I can’t figure out how to send a POST request that returns both releaseids and recordingids. Either one individually works fine.

I finally figured out that I should send the post request as if it were a form, but including multiple meta values doesn’t seem to work.

I can get GET requests to work, but only if I specifically use meta=releaseids+recordingids and I tried that for POST requests, but it didn’t work.

Actually, as I was writing this question, I started playing around, and thought about using a space for the POST request, since that would be the equivalent of + in a URL. And it worked. So I’m posting this for posterity.

So, tl;dr:
For an AcoustId POST request,
post as if to a form, and separate the meta elements with spaces.

Here’s working code in JavaScript using request-promise-native:

  public async queryAcoustId() {
    const params = {
      client: clientId,
      format: "json",
      duration: duration,
      fingerprint: fingerprint,
      meta: "recordingids releaseids",
    };
    return requestPromise.post("https://api.acoustid.org/v2/lookup").form(params);
  }