Relationship between an Action's "ID" and the REST API "action id" field?

Is there any relationship between an Action's "ID" and the REST API "action id" field? For our earliest actions (going back over 20 years ago!), the Action “ID” field” is something like “00-88880”. Putting “88880” into the REST API call https://{host}:{port}/api/action/88880/ returns information for that action. However, over many years of DSA-failover server migrations, more recent Actions have an ID that don’t appear to relate AT ALL to the REST API Action IDs:
Console ID → REST API ID
07-63558 → 117504070
05-1410020 → 85296100
05-1315801 → 85201881

Is there some magic formula to translate “07-63558” to “117504070”?

Figured it out, but figured I’d post anyway and answer my own question. :laughing:

If the Console Action ID = “x-y”, the REST API Action ID is (2^24*x+y).

So, for Console Action ID “07-63558”, the REST API ID is:
2^24 (= 16,777,216)
times 7 (= 117,440,512)
plus 63558 (= 117,504,070)

That was kinda fun. :rofl:

Gonna be kinda hard to do in my head, tho. :open_mouth:

2 Likes

Interesting… I have never experienced this.

We use RESTAPI extensively with our patching, and we do have DSA. Our actions are still prefixed with 00 or 01 (DSA).

I am curious how this could happen?

It looks like Actions start over from 0 with each incrementing of the ServerID (which is 00/01 for your Prod/DSA and 07 for our Prod). They’d need a way to keep them unique, so adding 2^24 * ServerID (allowing for 16,777,216 Action IDs per ServerID) seemed like a good idea, I guess. :slight_smile: I’ve still got one Action hanging around with ID “07-13” which would appear to confirm this theory. Our Actions under ServerID 05 only got up to about 1,465,714 in number an our Actions under ServerID 07 are up to 1,403,824 after over 7 years :open_mouth: . 16 million should be enough. :rofl:

2 Likes

I'm super curious, on what's the use-case for this? It's just not an area I've considered before...generally I've always referenced actions with the ID presented by REST, I can't say I paid as much attention to notice the Console was representing them differently...

That's some awesome math there by the way.
Another way to think of it, probably what's happening internally, is bitwise math.
2^24 = 16,777,216 = 1 left shift 24
2^24 * 7 = 117,440,512 = 7 left shift 24

So you might think of this as a 32-bit number, where the first 8 bits correspond to the "DSA ID" (00-, 01-, 02-, etc.) and the remaining 24 bits correspond to the "incrementing action ID from that specific DSA server".

So any action ID should be "DSA ID left shift 24 + Action ID"

Turns out, we can do this in Relevance, if it helps at all:

q: properties whose (it as string contains "shift")
A: right shift <integer> of <bit set>: bit set
A: left shift <integer> of <bit set>: bit set
T: 2.944 ms
I: plural property

q: left shift 24 of (7 as bits)
A: 111000000000000000000000000
T: 1.316 ms
I: singular bit set


q: "07-63558"
A: 07-63558
T: 1.259 ms
I: singular string

q: left shift 24 of (7 as bits) as integer
A: 117440512
T: 1.248 ms
I: singular integer

// What does the 'bit set' of the DSA ID '07' look like?
q: (left shift 24 of (preceding text of first "-" of it as integer as bits)) of "07-63558"
A: 111000000000000000000000000
T: 1.193 ms
I: singular bit set

// What is the 'integer' value of that DSA ID '07'?
q: ((left shift 24 of (preceding text of first "-" of it as integer as bits) as integer)) of "07-63558"
A: 117440512
T: 1.141 ms
I: singular integer



Console to ActionID:
q: ((left shift 24 of (preceding text of first "-" of it as integer as bits) ) as integer + following text of first "-" of it as integer) of "07-63558"
A: 117504070
T: 1.087 ms
I: singular integer

Or, the reverse: ActionID to Console Representation:

Starting from '117504070'


// To get the "Action ID of this DSA" part, I need to mask off the first 24 bits of the

// Starting from 'Action ID 117504070'
// To get the "DSA ID" part, I can right-shift 23 bits.
q: right shift 24 of (it as bits) of 117504070
A: 111
T: 1.026 ms
I: singular bit set

q: right shift 24 of (it as bits) of 117504070 as integer
A: 7
T: 0.877 ms
I: singular integer

// To get the "Action identifier from this DSA" I need to consider only the last 24 bits.
// What is the integer value of '24 bits where each bit is 1' ?

q: (concatenation of "1" of integers in (1, 23))
A: 11111111111111111111111
T: 0.726 ms
I: singular string

q: bit set (concatenation of "1" of integers in (1, 23)) as integer
A: 8388607
T: 0.596 ms
I: singular integer
// i.e. 0x7F FFFF

// What are is the value of the last 24 bits of 117504070 ?  I.e. 117504070  BITWISE AND 8388607
q: (117504070 as bits * 8388607 as bits) as integer
A: 63558
T: 0.460 ms
I: singular integer

//Final Boss Form
q: (last 2 of ("00" & right shift 24 of (it as bits) as integer as string) & "-" & (it as bits * 8388607 as bits ) as integer as string ) of 117504070
A: 07-63558
T: 0.258 ms
I: singular string
2 Likes

So, right now it’s mostly me wanting to confirm actions done via API in the Console (or wanting to act on a particular Console action via API) and not being able to find the information to correlate the two. Once the API code is figured out I won’t need to convert anything, but in the exploratory and troubleshooting phases I find it kinda necessary. :slight_smile:

1 Like