Wednesday, March 2, 2016

Getting HTTP response back from a CURL POST request

CURL request:
curl -H "Content-Type: application/json" -H "Authorization: Basic <AUTH_VALUE>" -X POST -d '<BODY_CONTENT>' <EP_URL> -k -i

Sample request:

curl -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46YWRtaW" -X POST -d 'MBfcEW/91R0VTobzhbC0ZGjGvHN4c9OXFsbByP8s9IwJErS5FVAgOhzxAJCLh3tfl0MJad5joQ7X5jl7mAzy40Rjv6Pe4wVghjVjdmofYL/fuX8m/pToUmvWc9t7S4DER31lGPBrlWEpEtIk/Nj025Xm5/cvAsUXpuTvLeOYt5v+cYHHmNtulG1dEfzMYQbjTQ1W/TVvWHG8LUfdXvVXt0R3QI6r/DnVszVIOKDbpD7OdKkLQ9J7W4kOSDZL1euIaSaWfLr0l+K0M+Eme1jG9np/qmNXOGZZyXR+ETpGuPDASV3TVK9hXKH18COwQ//e0db+6bGSPLPIb1KcshKIz4xZ3z15OaXDHRzZx71gFO4raVYIQAbxlx0wSw/D2Ap1qkXvBYFGIqAW+NPzVCGu/8Vu9BaUcSBZ5v1v4RKstWHKmaRTlRpRs0i1uEBoZHuw3sCN+HWLeIIjjNcWpNs3L1E1H/Wzny3uxwiPqZolA4LsnRj8kY5yJ1FoqNFs+i2lPqUvLhQZMCvPCF+onIQd1DImgK/VZSgDXNxRpo0N+6ZJEBMLAVWRSCHtHO28DLSBKjeacELa6jfzLEEE2cJIbTyjrGsQ+YTEHgL8zuQNIZZD5yO0bO4DU3eSGN66r4snnL+YC7r8cBfl8DQCBaWLNfs18eYtaOxwOJnqcZYI/8sWk8bFNDGgNn3imE3U1RpJrNZA68d53owzE0PQvZKkJIdR+Oy2W0wGcpjVOXj3HXLTXmjR9y/R/eZZ2nzvrPjwnnBGRYcX0pwenH+PSv+KSrilr6Z3cYWMlC8SUXDaHsXG6Pk3lxZX1sHziX0Sdgwb+KBtqpm5amU6rdBfSDmHO+Km3wxehlDh8Nv2BpwxWm1QGaXD1UXRyWLb5PgHPXPv21tG+kvhjoSYSUuXyMecnd8pwbjE1jRublcOvoMiXCLSd7lA9cg5TSTU0KgkR7N0E0Bt+znbpITiNqpmOhA9bjMwQyr5J6tzO8CjLL992Hn6WUe7mxu6Va9bv0kww6xyBSPdOXOfyDz/CxDZLtUsnmi2Fi70tmSAz690jzgaoupH8X2O7JhzRX7v+EMow5xqXPZ3i3d2FcvBjssmFPZh10Y13+sSTRWn3ciYcfx2c+/a00c+bxMSFg0FWEtcpptY0tQkJhrGn+f49ARDk2wZoYEBLkE/KKnpvk1p6HFFwkJsHdslrtV5QDjzRVPGx5rIrt1Sp3qhOFAYHnAoxF6XcgTLx8+q2tUlft+XdTy61zo/So1/+n6VxawCwZIkn5UHzAfAL2BaYA4OaqMnTY97s6ILCip4e5+/CKzT7LbL14cAjVs6fI4lZ/9nsuSgpTPBqzhvSzKRx3Pjg4TllcjaFyq0/f6MAEnSSz2Ir2tL5ue0fLI29YSLDfa6+R2t0fKvqkklg3/KhMs4vWlr/g2oFVyCtZWIWXXtnzN/z8g86H9UJv5FAg0x2/p/TXF87g+gYLgMGDAGuMWCHH2D789EXrdOq/hNnFDqoYoO9OzqnFWktO3Hjg7cqGUEVHlIwNuDxabzeGsj5zW+72F8gODWFKV1O10I+zEmA4RMdXkBlUz515jt/w/Q/Sb8SazMqEgzhL4LPsV6bFX9pSN8nb9PiI/6sXq2sTGIdN/czqrRE7j/xBywhvcZXA9g+8yiUnZKwJ5YQkoAIKCySh0auw19/GqaU4bwt3TPBuomW3UTdHE=' https://localhost:9443/endpoints/PageLogEventReceiver -k -i

Sample response: 

HTTP/1.1 401 Unauthorized
Set-Cookie: JSESSIONID=B083D193C0722F2CA8021BA2021BA4F0; Path=/; Secure; HttpOnly
Content-Type: text/html;charset=UTF-8
Content-Length: 14
Date: Wed, 02 Mar 2016 16:30:48 GMT
Connection: close
Server: WSO2 Carbon Server

_AUTH_FAILURE_