Http请求Android Java [关闭]

问题描述 投票:-3回答:1
我必须发送此HTTP请求

如何在Android上的Java上发出此请求?我也想找回答案

示例:

$ curl -X POST -H "cle: 780bf0421d7e962" -F "user_id=47554" -F "json=@/path/to/file.json" "https://www.visugpx.com/api/pushtrack" response (header -> json) : HTTP/1.0 400 Bad Request -> {"ERROR": "NO USER_ID"} HTTP/1.0 400 Bad Request -> {"ERROR": "NO USER_KEY"} HTTP/1.0 400 Bad Request -> {"ERROR": "NOT A VALID USER_KEY"} HTTP/1.0 400 Bad Request -> {"ERROR": "NO JSON FILE"} HTTP/1.0 400 Bad Request -> {"ERROR": "NOT A VALID JSON FILE"} HTTP/1.0 500 Internal Server Error -> {"ERROR": "SERVER ERROR"} HTTP/1.0 200 OK -> {"SUCCESS": {"id" = file_id}}

java android http httprequest httpresponse
1个回答
0
投票
您可以看看Retrofit,这是Square提供的适用于Android和Java的类型安全HTTP客户端

https://github.com/square/retrofit

© www.soinside.com 2019 - 2024. All rights reserved.