Page 1 of 1

Request CreateOrUpdateMarker to add color parameters

Posted: 11 Nov 2024, 13:29
by qq914218974
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

Re: Request CreateOrUpdateMarker to add color parameters

Posted: 11 Nov 2024, 17:12
by Gregory
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.