There is no access to Tags from the API. Setting link attributes is a bit strange. It wouldn't surprise me if it doesn't work on character creation. One thing to be aware of is the differance between linking to an attribute object and linking to a sheet attribute that doesn't have an actual attribute object backing it. Here's the code I use for setting the links in TokenMod: cid=mods.represents || token.get('represents') || '';
if('' !== cid) {
delta=findObjs({type: 'attribute', characterid: cid, name: f[0]}, {caseInsensitive: true})[0];
if(delta) {
mods[k]=delta.id;
mods[k.split(/_/)[0]+'_value']=delta.get('current');
mods[k.split(/_/)[0]+'_max']=delta.get('max');
} else {
mods[k]=`sheetattr_${f[0]}`;
}
}
I first find the character, if it exists, I set the links. I start by trying to find the attribute object. If I find it, I set the bar1_link to its id, then set the bar1_value and bar1_max to the parts of the attribute. If I don't find the attribute object, I set it to the name of the attribute prefaced by `sheetattr_`. That should make it work, even at creation. If what you're getting is empty bars, it's because setting to a particular attribute ID with the API does not cause the values to be set initially, so you have to do that manually. I think I remember that if you move the token or rotate it or some other mutation, they will snap in there, but this avoid that step and makes it work like you would expect it to work.