I'm trying to use the GraphQL API to to retrieve t...
# ask-community
z
I'm trying to use the GraphQL API to to retrieve the event logs for a given run and seem to be running into a little syntax error - not very familiar with GraphQL. here's the error:
Copy code
{
  "error": {
    "data": null,
    "errors": [
      {
        "message": "Variable \"runId\" of type \"ID\" used in position expecting type \"ID!\".",
        "locations": [
          {
            "line": 1,
            "column": 18
          },
          {
            "line": 2,
            "column": 21
          }
        ]
      }
    ]
  }
}
and my query:
Copy code
query LogsForRun($runId: ID){
  logsForRun (runId: $runId) {
    __typename
    ... on EventConnection {
      events {
        __typename 
        ... on ExecutionStepStartEvent {
          runId
          timestamp
          stepKey
        }
      }
    }
  }
}
with this variable:
Copy code
{
  "runId": "1d71f590-e925-42eb-af6c-831d524e1945"
}
🤖 1
r
I believe you just need to refine the type here: notice the
ID!
(signifying that
$runId
will be non null)
Copy code
query LogsForRun($runId: ID!){
  logsForRun (runId: $runId) {
    __typename
    ... on EventConnection {
      events {
        __typename 
        ... on ExecutionStepStartEvent {
          runId
          timestamp
          stepKey
        }
      }
    }
  }
}
✔️ 1
🎉 1
z
ah yes, thanks a bunch!