Currently using the C++ implementation of libcurl to interact with the Spotify API, looking for a way to pass multiple ‘Request Body Parameters’ during a POST request. The fields required are:
Looking at the example of a POST request found in libcurl’s documentation, it seems that this line
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=daniel&project=curl");
passes two parameters: "name" and "project". When I try a similar format with Spotify’s API
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "grant_type=authorization_code&code=abcdef&redirect_uri=example.com");
I get the following error
{"error":"unsupported_grant_type","error_description":"grant_type parameter is missing"}
I’ve validated that CURLOPT_POSTFIELDS works for this case by passing only the "grant_type", because the API response tells me that my request is missing a code, so clearly the API is reading the POSTFIELDS argument. Does anyone have insight on how to include multiple parameters in a POST request?
Source: Windows Questions C++