Automate Results via GraphQL

Hey there!

Another Question. :slight_smile:

I would like to access the automation results via GraphQL, but can’t really find them.
I found something under fileUploads, but I am more interested in the general status (success/failure) and e.g. the failing model elements.

Cheers!

1 Like

Thanks for the prompt.

The results are contextual to the model

query ExampleQuery($modelId: String!, $projectId: String!) {
  id
  project(id: $projectId) {
    model(id: $modelId) {
      automationStatus {
        automationRuns {
          id
          automationId
          automationName
          versionId
          createdAt
          updatedAt
          functionRuns {
            id
            functionId
            functionName
            functionLogo
            elapsed
            status
            contextView
            statusMessage
            results
          }
          status
        }
      }
    }
  }
}
2 Likes

Perfect, thanks!!

And just to share, what I also learned from that (Thanks, @jonathon!):
The (functionality of the) queries with the old naming (stream/branch/commit) have nothing to do with the queries of the new naming (project/model/version).
(Thought it would also just be a naming thing.)

I had a question about this the other day - is there a way to query a specific function run result?

Do you mean “given a function run id alone, can I query the results?”

Yeah, like, for example, the results of this query is already getting pretty huge:

{
    project(id:"e8fc8118bf"){
      model(id:"c1167fcb31"){
      automationStatus {
        automationRuns {
          functionRuns{
            results    
          }
        }
      }
    }
  }
}

It’d be good to be able to request the specific function run results we want

So adding an id query to functionRuns would do in this case?

1 Like

Correct, I think that would do

1 Like

Maybe analog to project/model/version queries?

functionRun (id: "xxx"){ ... }
functionRuns {
    items { ... }
}

… although I never liked the extra step of items{} (especially since there aren’t many other properties besides), but at least it would be handled the same way.

2 Likes

items is useful when you start to get lots of data you are fetching and need to use cursor, it’s niche, but it is there

3 Likes

This maybe what you are looking for @JdB

1 Like