I'm trying to list my builds that I have uploaded to Firebase App Distribution with the help of the google-api-python-client however I always get a HTTP status code 400.
I have created a service-account.json with full owner rights (for testing)
I have copied my project_id from Firebase Console.
I have copied my app_id from Firebase Console.
My Python script:
import os
from google.oauth2 import service_account
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
script_dir = os.path.dirname(os.path.abspath(__file__))
service_account_file = os.path.join(script_dir, 'service-account.json')
credentials = service_account.Credentials.from_service_account_file(service_account_file)
project_id = credentials.project_id
app_id = "1:310501947997:android:4f5183af1eddc4004eabb4"
service = build('firebaseappdistribution', 'v1', credentials=credentials)
try:
parent = f"projects/{project_id}/apps/{app_id}"
app_releases = service.projects().apps().releases().list(parent=parent).execute()
print(app_releases)
except HttpError as e:
print('Error response status code : {0}, reason : {1}'.format(e.status_code, e.error_details))
Error response status code : 400, reason : Request contains an invalid argument.
Does somebody have any pointers on what argument is invalid which is causing the HTTP 400?
Your code is using the
Project ID. The API requires specifying theProject Number.Refer to this documentation for more details on the required parameters:
projects().apps().releases().list()