1

I was trying to list the grantable roles for a project of mine on google cloud platform, and I came across these two formats for identifying the resource and running the command against.

The formats were:

  • //cloudresourcemanager.googleapis.com/projects/PROJECT_ID, and
  • https://cloudresourcemanager.googleapis.com/v3/projects/PROJECT_ID

How come the second uses the v3 in the URI identifier. Both did give the expected results but need to know why the difference.

George Udosen
  • 906
  • 1
  • 13
  • 28
  • The second URI is preferable. Most Google services have multiple versions of an API. v1, v2, v3, beta, alpha, etc. I recommend that you specify the API that your code uses. The first URI means use the latest API version which might break your code in the future. To understand the differences between API versions, you must consult the documentation. – John Hanley Mar 03 '22 at 20:55

1 Answers1

1

TLDR: use the first one.

The 'v3' in the second identifier (with the https URI), tells you that it was retrieved using the 3.x API version.

Right now (as march 2022), both URIs will work but in the future, the second one might not.

Why? because google could deprecate that API version in the next years.

(probably they will remove that 'v3' internally, but who knows).

Iñigo González
  • 3,735
  • 1
  • 11
  • 27
  • I disagree with your answer. Also, you are expressing your opinion which might mislead readers. IMHO, the second URI is preferable. Declare the API version that your code is written to use. Even the SDK libraries declare the API version via import naming. – John Hanley Mar 03 '22 at 20:51