收藏
回答

获取稳定版接口调用凭据报错 412 Precondition Failed , 怎么回事?

获取微信稳定版接口调用凭证报错 412 Precondition Failed , 是咋回事呢?

// org.springframwork.web.cleint.HttpClientErrorException: 412 Precondition Failed

API: https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/getStableAccessToken.html

代码如下:

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AccessTokenParam {

    /**
     * 固定值:client_credential
     */
    private String grant_type;

    /**
     * APPID
     */
    private String appid;

    /**
     * secret
     */
    private String secret;
}
AccessTokenParam accessTokenParam = AccessTokenParam.builder()
        .grant_type(GRANT_TYPE)
        .appid(appID)
        .secret(accountSecret)
        .build();

// 该行报错 org.springframwork.web.cleint.HttpClientErrorException: 412 Precondition Failed
String res = restTemplate.postForObject(URL, accessTokenParam, String.class);


最后一次编辑于  05-27
回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容