Search code examples
google-cloud-platformgoogle-artifact-registrygoogle-cloud-api-keys

Google Cloud REST API for Artifact Registry - URL is 404


I want to list all docker images of my artifact registry in Google Cloud Platform. Therefore I access the REST API.

Following this documentation: https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.dockerImages/list

curl -X GET --location "https://artifactregistry.googleapis.com/v1/my-project-id/europe-west3/eu.gcr.io/dockerImages?key=AIzaSyBDf2452534f7Y5PfKRjsdgs%12342432TIGrI" --http1.1 \
    -H "Authorization: Bearer ya29.aFGDggsGSDGSHG4253h2ATzmAsT8dYhWoGm7dG1n7Cj-YYgfk-VIV9e-m22gDQnJ-5X7zSB2dgqyj2_T4ZL6yjaDAb8YWCFpKh64UZ-lYjVj1MYnATA7ZiR7AqTPGvL4NbH-MG2q48Fg_NtesOrC4rOHoSyRMrYxFQyuYg4MIXFfsdf23513JSSDGSDASDASDGYSDGw0177" \
    -H "Accept: application/json"

Response is:

HTTP/1.1 404 Not Found
Date: Tue, 09 Apr 2024 09:28:17 GMT
Content-Type: text/html; charset=UTF-8
Server: ESF
Content-Length: 1659
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

The "Try this method" feature in the documentation gives me errors as well

enter image description here

Quite confusing since I am sure I match the regex pattern they require: /^projects\/[^/]+\/locations\/[^/]+\/repositories\/[^/]+$/


Any idea what I am doing wrong? I think I mix up things with the resource parameter somehow but I can't find any example for this request that leads me to the correct usage.


Solution

  • I just realized that I was missing the project path segment -> /project/[project-id]. I thought the documentation was having project as a placeholder for the actual project-id.