We use Cookies to help personalize and improve Roll20. For more information on our use of non-essential Cookies, visit our Privacy Policy here.
Accept
Advertisement Create a free account

Why the API limitation of set Avatar?

1525910948

Edited 1525912484
DXWarlock
Pro
Sheet Author
API Scripter
After living with it for a quite a while, auto builing characters off tokens, then manually finding the token again in search and dragging it to the sheet: I am curious why the limitation of setting a characters avatar when using API it must be in your library. But when manually setting one you can drag directly from the search results regardless if its marketplace, library, or web search. I can do this manually just fine: So why is when doing  character.set('avatar',imgsrc);  not allowed? The image URL it sets and what I try to set is the same..but with API I get: "ERROR: You cannot set the imgsrc or avatar of an object unless you use an image that is in your Roll20 Library. See the API documentation for more info."
1525915317
The Aaron
Forum Champion
API Scripter
My speculation is that it's because the search functionality already handles preventing you from being able to access an image you are not allowed to access by not returning it as a result.   The API does not have the functionality to know who you are when it runs, and thus can't provide a way of restricting based on what you are permitted.  
1525973599
DXWarlock
Pro
Sheet Author
API Scripter
Ah that could be it! Makes sense (but still annoying :P). Do you know any magical API way to copy the image to your library? I could copy it, then apply it afterwards with the API.
1525973751
The Aaron
Forum Champion
API Scripter
Not off the top of my head.  If you want to hit me up on other channels, I might be able to come up with some ideas... =D
Let the world know if you do!   I'm annoyed by this too.