Question

I have set up a "checkbox group" with the five schedule states in our organization's workspace. I would like to query using the Lookback API with the selected schedule states as filters. Since the LBAPI is driven by ObjectIDs, I need to pass in the ID representations of the schedule states, rather than their names. Is there a quick way to get these IDs so I can relate them to the checkbox entries?

Was it helpful?

Solution

Lookback API will accept string-valued ScheduleStates as query arguments. Thus the following query:

{
    find: {
        _TypeHierarchy: "HierarchicalRequirement",
        "ScheduleState": "In-Progress",
        __At:"current"
    }
}

Works correctly for me. If you want/need OIDs though, and add &fields=true to the end of your REST query URL, you'll notice the following information coming back:

GeneratedQuery: {
    { "fields" : true,
      "find" : { "$and" : [ { "_ValidFrom" : { "$lte" : "2013-04-18T20:00:25.751Z" },
                "_ValidTo" : { "$gt" : "2013-04-18T20:00:25.751Z" }
              } ],
          "ScheduleState" : { "$in" : [ 2890498684 ] },
          "_TypeHierarchy" : { "$in" : [ -51038,
                  2890498773,
                  10487547445
                ] },
          "_ValidFrom" : { "$lte" : "2013-04-18T20:00:25.751Z" }
        },
      "limit" : 10,
      "skip" : 0
    }
}

You'll notice the ScheduleState OID here:

"ScheduleState" : { "$in" : [ 2890498684 ] }

So you could run a couple of sample queries on different ScheduleStates and find their corresponding OIDs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top