简体   繁体   中英

Java Eclipse HttpUrlConnection Post request with JSON Body authentication

I tried and still trying to write Java code in Eclipse to call HttpUrl and gererate token and with the help of token I will call another URL to get data. I have tried it in Postman and its working there. Now I am writing java code to replicate whole Postman process. I tried to follow many ways and Stackoverflow posts but not getting data.Below is Postman steps. 在此处输入图像描述 在此处输入图像描述 在此处输入图像描述

Can you share your HTTP POST code?

As per your postman images, I think the API uses HTTPS and you're using HttpURLConnection .

You can try using HttpsURLConnection and give it a shot.

Hope it was useful.

Have a Nice Day:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM