Request CreateOrUpdateMarker to add color parameters

This is a place for people to chare the custom macros they have written.

Moderator: Moderators

qq914218974
Posts: 2
Joined: 05 Jan 2023, 14:05

Request CreateOrUpdateMarker to add color parameters

Postby qq914218974 » 11 Nov 2024, 13:29

Request about “CreateOrUpdateMarker” API to add color parameters
e.g.

Code: Select all

http://[ip]:4430/titan/script/2/Timelines/CreateOrUpdateMarker?handle={handle}&externalId={string}&time={}&legend={string}&colour={}


Or is there any other API that can set the Marker color in the timeline?

Looking forward reply...

Daniel
User avatar
Gregory
Posts: 1349
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Request CreateOrUpdateMarker to add color parameters

Postby Gregory » 11 Nov 2024, 17:12

If you are writing a macro you can write the following:

Code: Select all

Handles.SetHaloForHandles(Timelines.CreateOrUpdateMarker(userNumber:1, "Ext1", "00:00:00.01", "Test Legend"), "#ff0000")
The CreateOrUpdateMarker function returns the handle associated with the trigger that was either created or updated, this can be used as a parameter to the SetHaloForHandles function that can set the halo colour for it.

For WebAPI it is not possible to chain function calls together in this way so you would need to run separate commands and parse the returned JSON e.g.:

Code: Select all

http://localhost:4430/titan/script/2/Timelines/CreateOrUpdateMarker?handle_userNumber=1&externalId=Ext1&time=00:00:00.01&legend=WebAPI

The above will return the details of the handle in JSON e.g.:

Code: Select all

{
  "titanId": 1829,
  "type": "timelineTriggerHandle",
  "Links": [],
  "active": false,
  "halo": "#FF0000FF",
  "icon": null,
  "information": null,
  "legend": "WebAPI",
  "notes": "",
  "selected": false,
  "userNumber": {
    "hashCode": 0,
    "userNumbers": null
  }
}

From which you will need to read the titanId that can then be used as follows:

Code: Select all

http://localhost:4430/titan/script/2/Handles/SetHaloForHandles?handles_titanId=1829&colour=0000ff

It is also possible to read from the JSON what the current halo colour is using the halo property, assuming it has been set. There is also a property for legend however since that will be set by calling CreateOrUpdateMarker it should just return the new legend.

Who is online

Users browsing this forum: No registered users and 12 guests