weixin.popular.api.TokenAPI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weixin-popular Show documentation
Show all versions of weixin-popular Show documentation
The weixin-popular is a JAVA SDK for weixin. Weixin web url is https://mp.weixin.qq.com.
package weixin.popular.api;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.RequestBuilder;
import weixin.popular.bean.token.Token;
import weixin.popular.client.LocalHttpClient;
/**
* ACCESS_TOKEN API
* @author LiYi
*
*/
public class TokenAPI extends BaseAPI{
/**
* 获取access_token
* @param appid appid
* @param secret secret
* @return Token
*/
public static Token token(String appid,String secret){
HttpUriRequest httpUriRequest = RequestBuilder.get()
.setUri(BASE_URI + "/cgi-bin/token")
.addParameter("grant_type","client_credential")
.addParameter("appid", appid)
.addParameter("secret", secret)
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,Token.class);
}
}