Rest 以URL字符串形式发布请求?

Rest 以URL字符串形式发布请求?,rest,post,oauth-2.0,google-api,Rest,Post,Oauth 2.0,Google Api,我有一个应用程序,如果我将请求作为字符串传递,它可以执行POST和GET请求 我试图点击一些谷歌API,但在尝试发出refresh\u令牌POST请求时遇到了麻烦 谷歌想要的格式是: POST /o/oauth2/token HTTP/1.1 Host: accounts.google.com Content-Type: application/x-www-form-urlencoded client_id={client_id}& client_secret={client_secr

我有一个应用程序,如果我将请求作为字符串传递,它可以执行
POST
GET
请求

我试图点击一些谷歌API,但在尝试发出
refresh\u令牌
POST
请求时遇到了麻烦

谷歌想要的格式是:

POST /o/oauth2/token HTTP/1.1
Host: accounts.google.com
Content-Type: application/x-www-form-urlencoded

client_id={client_id}&
client_secret={client_secret}&
refresh_token=1/6BMfW9j53gdGImsiyUH5kU5RsR4zwI9lUVX-tqf8JXQ&
grant_type=refresh_token
我的问题是,如果
client\u id
client\u secret
refresh\u token
都是URL编码的,我可以将此POST请求作为字符串进行发送吗

像这样:

https://accounts.google.com/o/oauth2/token?client_id={client_id}&client_secret={secret}&refresh_token=1%26BMfW9j53gdGImsiyUH5kU5RsR4zwI9lUVX-tqf8JXQ&grant_type=refresh_token

您的示例不是“URL编码”,它只是在
GET
请求中传递信息。如果
/o/oauth2/token
支持
GET
,则是,这将起作用。如果它只支持
POST
,这将不起作用。在我的应用程序中,我将其切换到POST,但我不知道它下面在做什么。您所说的手动URL编码是什么意思?我指的是将空格更改为%20的过程。我读到刷新令牌中的“/”需要编码。同样,如果
/o/oauth2/token
支持
GET
,那么这将起作用。如果没有,那就不会了。