How to correctly encode special characters for PHP cURL using Postman

I’ve recently been working with a REST API for a project, where we had to provide a filter that needed quote marks in it.

/api/v1/users?filter=status+eq+"ACTIVE"+or+status+eq+"DEPROVISIONED"

When I was passing this via my PHP API wrapper, this was giving me no end of heck. I spent ages looking for how to escape those “”‘s, and after testing with Postman that this worked great like this, for some reason I notice an option in Postman I’d never clicked before.

‘Code’

Just up there by Save on the top right.

Then like an idiot, I realised I just needed to use the ASCII code for “, and I’d have been fine. Copy and pasted this into the function call going to my API wrapper, and we have liftoff.

If you want to be even smarter, you can have Postman generate all the code needed when you have a working call in the app! This would have saved me HOURS in the past if I’d known this.

Enjoy!