0

I have curl request to push data to the server from Android.Below is the Curl request:

curl -v -H "Accept: application/json" -H "Content-type: application/json"  -H "Authorization: Token token=SNKh9UP4RX2Ltyxo9JnG , username=local1admin" -X PATCH -d '{"fcm": {"token":"sd7sdf6sdffd5"}}'  http://myapp-back.herokuapp.com/fcms/1

How should I do post request using volley? I am confused because I have no idea where to put this:

'{"fcm": {"token":"sd7sdf6sdffd5"}}'

So please anyone help me to get it done. Any answers are appreciable. Thank you. Peace out!

najaf k.a
  • 31
  • 3

1 Answers1

0

I ran into similar issue with my curl command below -

curl 'https://ws.test.com/handle_email?embed_load_code=undefined' -H 'Accept: /' -H 'Referer: https://cdn1.test.com/widgets/12345/12345/widget.html' -H 'Origin: https://cdn1.test.com' -H 'User-Agent: Test App' -H 'DNT: 1' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'campaign=12345&merchant=12345&original_data=%257B%2522site%2522%253A%2522site-11111-www.test.com%2522%257D&share_id=&email=test%40test.com' —compressed

Easy way to figure out how to organize the different pieces of cUrl query to Volley Request is by first running this cUrl query in Post Man and intercept request object in Charles Proxy - Ref : Simulate a specific CURL in PostMan

In my case -

  1. -H values were added as Header items
  2. --data values are added as body
  3. Content-Type set as application/x-www-form-urlencoded
Rams_QA
  • 121
  • 7