I tried the approach mentioned by Onkaar Singh,
- Open POSTMAN
- Click the "Import" tab in the upper left.
- Select the Raw Text option and paste the cURL command.
- Hit the import, and you will have a team in your postmaster!
But the problem is that it does not work for Apis requiring authorization.
This was my curl request:
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d ' {"customer_id":"812122", "event":"add_to_cart", "email": " abc@def.com ", }' -u 9f4d7f5445e7: https://api.myapp.com/api/event
After importing the correct body import, headers and URLs were also imported. Only api key 9f4d7f5445e7 which
-u 9f4d7f5445e7: https://api.myapp.com/api/v1/event
in a request for curls was not imported.
The way I solved this, -u is mainly used for authorization. Therefore, using it in Postman, you must take the API key (which in this case is 9f4d7f5445e7 ) and make Base64 Encode. After encoding, it will return the value OWY0ZDdmNTQ0NWU3 . Then add a new title, the key name will be Authorization , and the key value will be Basic OWY0ZDdmNTQ0NWU3 . After making these changes, the request worked for me.
Base64 online encoders are available, which I used http://www.url-encode-decode.com/base64-encode-decode/
Hope this helps !!!
source share