Zapi API - 收到错误期望声明'qsh'具有值



我只是尝试从ZAPI API获取常规信息,但是获取错误期望索赔'qsh'具有'7f0d00c2c77e4af27f27f336c87906459429429d1074bd6eabbb81249e1042d4b844374 E5BD92DA0C725E9175DE9'

API链接:https://prod-api.zephyr4jiracloud.com/connect/public/rest/rest/rest/api/1.0/config/generalIninformation

任何人都可以帮我吗?

查询字符串参数必须按字母顺序排序,这将解决问题。
请参阅此链接以获取参考:
https://developer.atlassian.com/cloud/bitbucket/query-string-hash/

我绝对可以为您提供帮助。您需要以正确的方式生成JWT令牌。

package com.thed.zephyr.cloud.rest.client.impl;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import com.thed.zephyr.cloud.rest.ZFJCloudRestClient;
import com.thed.zephyr.cloud.rest.client.JwtGenerator;
public class JWTGenerator {
                public static void main(String[] args) throws URISyntaxException, IllegalStateException, IOException {
                                String zephyrBaseUrl = "https://prod-api.zephyr4jiracloud.com/connect";
                                String accessKey = "TYPE YOUR ACCESS KEY-GET IT FROM ZEPHYR";
                                String secretKey = "TYPE YOUR SECRET KEY-GET IT FROM ZEPHYR";
                                String userName = "TYPE YOUR USER - GET IT FROM ZEPHYR/JIRA";
                                ZFJCloudRestClient client = ZFJCloudRestClient.restBuilder(zephyrBaseUrl, accessKey, secretKey, userName).build();
                                JwtGenerator jwtGenerator = client.getJwtGenerator();
                                String createCycleUri = zephyrBaseUrl + "/public/rest/api/1.0/cycles/search?versionId=<TYPE YOUR VERSION ID HERE>&projectId=<TYPE YOUR PROJECT ID HERE>";
                                URI uri = new URI(createCycleUri);
                                int expirationInSec = 360;
                                String jwt = jwtGenerator.generateJWT("GET", uri, expirationInSec);
                                //String jwt = jwtGenerator.generateJWT("PUT", uri, expirationInSec);
                                //String jwt = jwtGenerator.generateJWT("POST", uri, expirationInSec);
                                System.out.println("FINAL API : " +uri.toString());
                                System.out.println("JWT Token : " +jwt);    
                }
 }

还克隆此存储库:https://github.com/zephyrdeveloper/zfjcloud-rest-api,它将为您提供所有相应编码的方法。您可以构建一个Maven项目以直接导入这些依赖项。

*我还花了几天时间来弄清楚这一点,所以要耐心等待,这只是您生成右JWT的时间。

相关内容

  • 没有找到相关文章

最新更新