question

andi avatar image
andi asked

VRM API Demo Access results in 401

Hey,

we are working on a project with a small solar station but don't have the victron hardware yet. To gain some experience with the vrm api, i tried to work with the demo login. I am able to get a bearer token for the demo login and the api documentation sais the user id for the demo login is 22.

I set the header as follows (of course with the real bearer token without the sq. brackets):

X-Authorization: Bearer {[the_bearer_token_here]}

Unfortunately, every attempt to access any API endpoint like https://vrmapi.victronenergy.com/v2/users/22/installations results in 401 and

{
  "success": false,
  "errors": "Token is invalid.",
  "error_code": "invalid_token"
}

I tried this with curl and Postman without any success.


Is there a way to get access to the demo data or am i doing something wrong?

Many thanks in advance

Andi

VRM
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

3 Answers
Teun Lassche avatar image
Teun Lassche answered ·

Hi,


Please try this exact same cURL command (just tested, working fine) with your token:


curl 'https://vrmapi.victronenergy.com/v2/users/22/installations?extended=1&idSite=13388' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'DNT: 1' \
  -H 'X-Authorization: Bearer YOUR_TOKEN_HERE' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36' \
  -H 'Content-Type: application/json' \
  --data-binary '[]'


1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

andi avatar image andi commented ·

Hey, thanks a lot. It was my own stupidity. I always tried it with the braces surrounding the token. It's a little bit like calling the technical support for a not working tv because the power cable is not plugged in :D


In my defense, choosing "Bearer Token" as authorization in Postman and entering the token in the token field also doesn't work. I have to explicitly put the token in the header.


Again, thanks! Problem solved!

0 Likes 0 ·
peter-mostert avatar image
peter-mostert answered ·

Please show Postman Screen Shots. I can't get it to work

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

zamlaurie avatar image
zamlaurie answered ·

Did you get this to work. I can't get it to work using postman

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.