B
B
brar2020-04-21 15:21:04
linux
brar, 2020-04-21 15:21:04

curl get. How to pass header from json?

The below request is not sending data:

curl -v -H "Content-Type: application/json" -H -d '{"UID": "xxx", "SID": "yyy"}'  "https://abcxyz.ru/api"

Log piece:
> Host: abcxyz.ru
> User-Agent: curl/7.69.1
> Accept: */*
> Content-Type: application/json
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 403 Forbidden


If you make a request without json then OK:
curl -H "UID: xxx" -H "SID: yyy" "https://abcxyz.ru/api"

Log piece:
> Host: abcxyz.ru
> User-Agent: curl/7.69.1
> Accept: */*
> UID: xxx
> SID: yyy
>
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [249 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [249 bytes data]
* old SSL session ID is stale, removing
{ [5 bytes data]
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK


That is, according to the log, data from json is not sent and, accordingly, the server returns 403.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2020-04-21
@brar

why do you have -H before -d ?
and, most likely, you need to specify the post method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question