syslogic / agconnect-publishing-gradle-plugin

Huawei AppGallery Connect Publishing Gradle Plugin
MIT License
6 stars 0 forks source link

How to make get upload-url api call working #1

Closed james64 closed 1 year ago

james64 commented 1 year ago

Hey, we are trying to make api call to upload-url but all I am getting is 404

$ curl -I -H 'Accept: application/json' \
               -H 'Content-Type: application/json' \
               -H "client_id: ${client_id}"
               -H "Authorization: Bearer ${access_token}" \
               'https://connect-api.cloud.huawei.com/api/publish/v2/upload-url?appId=${appid}&suffix=aab&releaseType=1'
HTTP/1.1 404 Not Found
Connection: keep-alive
Date: Thu, 23 Mar 2023 15:10:26 GMT
X-Cache: Error from cloudfront
Via: 1.1 f3303a5632dc925c26253530523fa328.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: PRG50-C1
X-Amz-Cf-Id: cgRkAZ4FbsHwuJnAda-VCcPe2QI7N87oPWd8h6aBb2fH6MqEhMoXMA==

We have

  1. created an api client in AG in users-permission - connect api - api client - create. It has role of administrator and our only project which our apps are part of
  2. Used its client_id and client_secret in curl above
  3. Fetched access_token by succesfully calling https://connect-api.cloud.huawei.com/api/oauth2/v1/token

We have double checked all with your source code and every single thing seems to be matching. Headers, query params etc. Is there anything we need to do in AG console? Enable something somewhere....

We are terribly sorry to mis-use this bugtracker for this question. Your gradle plugin is one of rare resources we were able to find. You can maybe as well see this as question of what needs to be configured in AppGallery Connect to make your gradle plugin work. Thanks for any sort of reply :+1:

james64 commented 1 year ago

API client created in AppGallery web console needs to be configured with Project set to N/A as advised in this stack overflow. It then works.

syslogic commented 10 months ago

@james64 Haven't documented this here, because I've created a table which lists which credentials are required for which API (this Java/Gradle project is only an add-on to a PHP project, with similar functionality): https://github.com/syslogic/php-hms - the equivalent: https://github.com/syslogic/php-hms/blob/master/src/AppGallery/Publishing/Publishing.php