Issues passing body key / value pair

I confess that I’m a periodic Postman user that in times past has just been able to “get it to work” mostly by trial and error (this is meant as a negative-ish commentary on myself, not on Postman). But I’m afraid that I’ve run into a situation that for some reason I cannot yet get to work.

I can successfully make my API call using basic authorization to return results, but what I’m having trouble with is passing filter parameters to restrict the data being returned.

The API’s documentation suggests that I need to pass my filter parameters as key / value pairs like email[is] = “{emailaddress}” for instance, where:

key: email[is]
value: “{emailaddress}”

The complete cURL command apparently is to end up looking like the following, if that helps:

curl https://{url}
-G
-u {api_key}:
–data-urlencode email[is] = “{emailaddress}”

Nothing I’ve yet tried in Postman to send such a filter has worked. Any thoughts?

Much appreciated in advance.

Thanks.

Can you share a screenshot of how you’ve set up the Params of your request? Are you directly passing in an email address or are you using Postman variables to populate this?

Hi Matt. thanks for your reply. I’m trying to use Postman variables, and have tried passing them just about every which way as key value pairs - Params and Body as both form-data and x-www-form-urlencoded. Passing as Body > form-data is the closest I can get the Postman generated cURL code to match that of the API documentation, but something still isn’t right (see screenshot).

Sorry, as I just know this is a simple thing. I’ve used Postman to successfully work with other API’s but it’s just this filtering that’s causing me issues.

Thanks.

Try:

  • removing the quotes from around the email address
  • switch back to x-www-form-urlencoded
  • on the Authorization tab, make sure you have “Basic auth” and your username and password reflect your example cURL request for the -u parameter, whatever is before the colon is the username, after the password

Hi again. I confirmed the authorization tab settings, and I am getting a return - just not a filtered one - so I know they’re correct. I tried your other 2 suggestions again too, but that results in Postman-generated cURL code as in the screenshot, compared to what the 3rd party API documentation is expecting (shown in the green circle).

Thanks.

Ah, this screenshot is showing an extra parameter to the original post.

Add limit and then 5 beneath email[is] and [email protected] as another key value pair.

The cURL code will be marginally different because:

  • Postman uses -X GET to specify a GET request where as your example is using -G, they are interchangeable
  • cURL offers the -u option as a simple way to provide a username and password combination. It then base64 encodes these into an Authorization: Basic header behind the scenes, so what you’re seeing in Postman is the rawest format - the Authorization tab in Postman is doing the encoding instead of the -u option
  • Postman is encoding the data itself, so it can just use the regular -d data option, cURL is affording you more utility by encoding it for you if you specify --data-urlencode
  • Postman adds some additional headers, this shouldn’t represent any kind of a problem