API user_variables hard to create and not visible in API while XML export shows them!

Here you can submit bugreports
Post Reply
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

API user_variables hard to create and not visible in API while XML export shows them!

Post by emcodem »

Hi again :-)

For the webinterface, i need to provide a manual on how to create user_variables but it looks like this part is somehow buggy. Maybe there are workarounds already known?
user_Var.png
user_Var.png (59.04 KiB) Viewed 7761 times
What i do when creating a new variable is to open the variables editor on a random node, e.g. populate varaibles. In the "Select variable:" window, i select the "User" tab (if any) and thne rigthclick - New. After that, the corresponding variable does not exist in the workflow export xml, nor in the API
http://localhost:65445/api/json/v1/work ... 1220091541

What i could already figure out is, that the created user_variable from above will exist in the exported workflow xml as soon as i started some job after registering the new variable.
But i did not yet manage to get out what is needed to get the variable visible in the API calls. I know it is possible because i already had some variables in the API calls but i don't know how to get there intentionally.

By the way, i did not yet manage to get ANY user_variables in the details call, even when the above one already shows the variable. I would love to use the details call, as the other one contains a lot less information. But currently i need to utilize both calls to get out all details ;-)
http://localhost:65445/api/json/v1/workflows/details


Cheers!
emcodem
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: API user_variables hard to create and not visible in API while XML export shows them!

Post by admin »

Hi emcodem,

A while ago I fixed several issues regarding dealing with user variables in different scenarios. The issues you're reporting are some of them so stay tuned for the next version. I will send you a beta-build so you can test your nice web interface :-)

-steinar
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: API user_variables hard to create and not visible in API while XML export shows them!

Post by emcodem »

Hey Steinar,

lots of thanks for the quick response, looking forward to the beta but take your time...
Actually i thought there might be a simple workaround as it seems to work sometimes... I guess one just has to know where to click in order to present the variable to the API as well?

Thanks!
emcodem
emcodem, wrapping since 2009 you got the rhyme?
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: API user_variables hard to create and not visible in API while XML export shows them!

Post by emcodem »

Hey steinar,

very good news, i was able to find a workaround:
The user_variables are only presented to the api when they are (or have ever been) actually used in a value field.

So i can create and edit variables but only when they are used in some value field (i used populate to test, i believe it works with any value field), they are visible to the API.
populate_bug.png
populate_bug.png (13.94 KiB) Viewed 7739 times
In the end this makes somehow sense.. why should non used variables be presented to the API ;-)
This way i can write a nice user manual how to use the mighty variable feature for job creation on the WebUI

Cheers!
emcodem
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1687
Joined: Sat Feb 08, 2014 10:39 pm

Re: API user_variables hard to create and not visible in API while XML export shows them!

Post by admin »

User variables not used in a workflow will not be exposed in the API (or the exported XMLs). As you point out, this makes sense and it's by design.

-steinar
Post Reply