REST API knowledge exchange
Post Reply
Kazz
Expert
Posts: 163
Liked: 18 times
Joined: Feb 08, 2018 3:47 am
Full Name: Kazz Beck
Contact:

Unsupported RESTAPI version

Post by Kazz »

Could anyone shed some light on to why i am getting Unsupported RESTAPI version ?

Code: Select all

import requests
import json

headers = {
    'accept': 'application/json',
    'x-api-version': '1.0-rev1',
    'Content-Type': 'application/x-www-form-urlencoded'
}

data="grant_type=password&username=veeamapi&password=YOURPASS!&refresh_token=&code=&use_short_term_refresh=&vbr_token="

response = requests.post("https://vbr:9419/api/oauth2/token", headers=headers, data=data, verify=False)
print(f"response: {response.text}")
token = json.loads(response.text).get("access_token")
print(f"token: {token}")

headers['Authorization']="Bearer "+token
headers['x-api-version']="1.0-rev1"
response_jobs = requests.post("https://vbr:9419/api/v1/jobs/states", headers=headers, verify=False)
print(f"response_jobs: {response_jobs.text}")

Unverified HTTPS request is being made to host 'vbr'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/lates ... s-warnings
warnings.warn(
response_jobs: {"errorCode":"NotImplemented","message":"Unsupported RESTAPI version. The following versions are supported: v1.0-rev1, v1.0-rev2, v1.1-rev0","resourceId":null}

Thanks
jorgedlcruz
Veeam Software
Posts: 1547
Liked: 669 times
Joined: Jul 17, 2015 6:54 pm
Full Name: Jorge de la Cruz
Contact:

Re: Unsupported RESTAPI version

Post by jorgedlcruz »

Hello,
That is odd, not sure what version you are running of VBR, but in v12.1 I am using the next without any issue, try it:

Code: Select all

curl -X 'POST' \
  'https://veeam-vbr:9419/api/oauth2/token' \
  -H 'accept: application/json' \
  -H 'x-api-version: 1.1-rev1' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=password&username=MYUSERNAME&password=MYPASS&refresh_token=&code=&use_short_term_refresh=&vbr_token='
You can be more precise and use the version that matches your VBR actually: Let us know
Jorge de la Cruz
Senior Product Manager | Veeam ONE @ Veeam Software

@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
Kazz
Expert
Posts: 163
Liked: 18 times
Joined: Feb 08, 2018 3:47 am
Full Name: Kazz Beck
Contact:

Re: Unsupported RESTAPI version

Post by Kazz »

12.00.1420
Kazz
Expert
Posts: 163
Liked: 18 times
Joined: Feb 08, 2018 3:47 am
Full Name: Kazz Beck
Contact:

Re: Unsupported RESTAPI version

Post by Kazz » 1 person likes this post

Found an answer to my error here - >restful-api-f30/unable-to-authenticate-t89949.html

response_jobs = requests.get("https://vbr:9419/api/v1/jobs/states", headers=headers, verify=False)
jorgedlcruz
Veeam Software
Posts: 1547
Liked: 669 times
Joined: Jul 17, 2015 6:54 pm
Full Name: Jorge de la Cruz
Contact:

Re: Unsupported RESTAPI version

Post by jorgedlcruz »

Ah yes I can see now!

As you had all together was difficult to see, right the auth needs POST, but jobs and other endpoints are GET if you just need info.

Good stuff. Looking forward to see more posts from you sharing great scripts and apps that help and inspire others.

Thank you
Jorge de la Cruz
Senior Product Manager | Veeam ONE @ Veeam Software

@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest