How set CurrentPaletteHandle property with Web APIs?

Discussion and chat related to developing interfaces to the Titan software using the web API.

Moderator: Moderators

Jorge Garcia
Posts: 6
Joined: 13 Apr 2024, 14:36

How set CurrentPaletteHandle property with Web APIs?

Postby Jorge Garcia » 13 Apr 2024, 14:49

I'm trying WEB APIS, and tried to set current palette for operations, like deletion of a palette, or replace a palette, for example.

I know in a MACRO I can use this API
ActionScript.SetProperty("Palette.CurrentPaletteHandle", handle:"Location=Colours,2,2")

But how must I use this WEB API?
POST /titan/set/2/Palette/CurrentPaletteHandle

What must I send in the body? I have tried with titanId as a number, I have tried to put titanId in JSON format or location in JSON format, or the entier handle I get with handles API, and nothing works...

Somebody knows how to use this WEB API?

Thanks
icke_siegen
Posts: 1089
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: How set CurrentPaletteHandle property with Web APIs?

Postby icke_siegen » 14 Apr 2024, 10:12

Not an answer but a solution:

In order to delete a palette by its usernumber you can do

Code: Select all

http://localhost:4430/titan/script/2/Handles/SetSourceFromUserNumber?handlePath=Handle.Palette&userNumber=20
http://localhost:4430/titan/script/2/Handles/ConfirmDelete


Alas, in order to delete a palette by its location you can do

Code: Select all

http://localhost:4430/titan/script/2/Handles/SetSourceHandleFromHandle?handle_location=Colours_1_5
http://localhost:4430/titan/script/2/Handles/ConfirmDelete


However I don't know if there is a significant functional difference between deleting a palette with DeleteCurrentPalette() and deleting the palette handle as suggested above.
icke_siegen
Posts: 1089
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: How set CurrentPaletteHandle property with Web APIs?

Postby icke_siegen » 16 Apr 2024, 07:33

Courtesy of Greg: the answer to your question: in order to to set a palette as current and then delete it, by Web API, you can do

Code: Select all

http://localhost:4430/titan/script/2/ActionScript/SetProperty?id=Palette.CurrentPaletteHandle&value_handle=Location:Colours,1,1
http://localhost:4430/titan/script/2/Palette/DeleteCurrentPalette


He also writes

The short answer is that no it should not make any difference if you use DeleteCurrentPalette from the Palette namespace or deleting from the Handles namespace. They both end up using the same underlying function that both removes the handle and tells Titan to delete the underlying item in the engine.


Now it is up to you to decide which solution you prefer.
Jorge Garcia
Posts: 6
Joined: 13 Apr 2024, 14:36

Re: How set CurrentPaletteHandle property with Web APIs?

Postby Jorge Garcia » 16 Apr 2024, 22:35

Thanks a lot for your help :-)

Who is online

Users browsing this forum: No registered users and 1 guest