views:

41

answers:

1

curl - looking to test some Rest APIs - what is the syntax to Post xml to a rest api with basic authentication?

A: 

This works for me.

curl -i POST -u "user:password" -H "Content-Type: application/xml" -d "<Foo></Foo>" http://example.org/resource

http://curl.haxx.se/docs/manpage.html

Darrel Miller
What if it is an HTTPS url? Is there a way to trust certificates?
moorecats
@moorecats the --cert option allows you to do that.
Darrel Miller
I exported a certificate from a url i was trying to hit and put that path in the command in this way - curl https://url.com --cert c:\cert.cer and I got this error now - curl: (58) unable to use client certificate (no key found or wrong pass phrase?) My knowledge of certificates are limited, I know I do not need to put in a passphrase when hitting the site via Chrome/Firefox etc, so what is it looking for?
moorecats