What's new
  • Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as: All that and more! Registration is quick, simple and absolutely free. Join our community today!

Help Unknown language to JSON

francislargo

Leecher
Joined
Jan 22, 2020
Messages
6
Reaction score
0
Pwede po paconvert ng code na ito to JSON request body.

curl -d '{
"recipientPhone": {
"countryCode": "HT",
"number": "50936377111"
},
"senderPhone": {
"countryCode": "US",
"number": "13059547862"
},
"operatorId": 173,
"amount": 15,
"customIdentifier": "transaction by john@example.com"
}'

Example code po iyan ng isang company. Pero pag irun ko na bad request (invalid format daw).
 
Or pano nalang po pala mag lagay ng another key &value sa value ng key parang ganto po siya pero mali e.

{

"senderPhone": {
"countryCode": "PH",
"number": "631234567890"
}

}
 

bakakon

Grasshopper
Lagyan mo ng content type yung request mo,

Code:
curl -H "Content-Type: application/json" \
    -d '<JSON HERE>'
 

homer_simpson

Eternal Poster
, Last edited:
try this:
Code:
curl -H 'Content-Type: application/json' -Xpâtch -d 'countryCode=PH&number=123456789' https://theserver.com/api/senderphone
adjust mo nalang yung endpoint to reflect the destination.
 
Lagyan mo ng content type yung request mo,

Code:
curl -H "Content-Type: application/json" \
    -d '<JSON HERE>'
May ganyan na po siya sir sa http request na pinaglalagyan ko sa integromat. Kaya hindi ko na sinasama. Need parin po ba isama sa request body kahit ganun?
 

Online statistics

Members online
1,240
Guests online
1,608
Total visitors
2,848

Forum statistics

Threads
848,974
Messages
15,041,645
Members
1,369,932
Top