[英]POST request on a https server in JAVA
I came here to ask my question after searching for 2 days !! 搜索了2天后我来这里问我的问题!! My question is about REST api call and POST request on my api.
我的问题是关于我api的REST api调用和POST请求。 I have already seen tutorial in JAVA about creating a httpclient in my side with httpsURLConnection to connect to the api and I did a POST request.
我已经在JAVA中看到了关于在我身边用httpsURLConnection创建一个httpclient连接到api的教程,我做了一个POST请求。 It works for instance with https://www.example.com .
它适用于https://www.example.com 。 BUT it did not work for the case below.
但它不适用于下面的情况。
Case: (I have to do that in JAVA with eclipse) The REST API is accessible at https://test.api.kolibree.com . 案例:(我必须使用eclipse在JAVA中执行此操作)可以通过https://test.api.kolibree.com访问REST API。 I get a client_id (=5) and a client_secret (= X7doOhLCRbuT0FIgBsmy) to access the API.
我得到一个client_id(= 5)和一个client_secret(= X7doOhLCRbuT0FIgBsmy)来访问API。 First, to make an API call, I need to provide the http-x-client-idand http-x-client-sig headers.
首先,要进行API调用,我需要提供http-x-client-id和http-x-client-sig标头。 http-x-client-sigis computed using the absolute url of the request.
使用请求的绝对URL计算http-x-client-sigis。 (I managed to compute it)
(我设法计算了它)
Secondly: to connect to a Kolibree account using an email and a password, make a POST request to v1/accounts/request_token/ with body arguments email (=android.test@kolibree.com) and password (=test). 其次:要使用电子邮件和密码连接到Kolibree帐户,请向v1 / accounts / request_token /发送POST请求,并使用正文参数email(=android.test@kolibree.com)和密码(= test)。
Problem: I don't know how to handle the client id and signature headers to do an API call. 问题:我不知道如何处理客户端ID和签名标头来进行API调用。 I haven't seen any tutorials talking about that.
我还没有看到任何关于这个的教程。 Furthermore, how to handle the email and password to do a POST request.
此外,如何处理电子邮件和密码以执行POST请求。
Thanks a lot for your kind attention. 非常感谢您的关注。 I would be infinitely thankful.
我会非常感激。
Alex 亚历克斯
Would this be an example of doing HTTP POST with parameters? 这是使用参数进行HTTP POST的示例吗?
https://hc.apache.org/httpcomponents-client-ga/quickstart.html https://hc.apache.org/httpcomponents-client-ga/quickstart.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.