Querying Annotations

I’m trying to find a way to query the ‘Notes’ section of a ProjectMedia:

This seems like it would be found in the “annotation” field, and that requires the “annotation_type” argument. What exactly does this argument refer to, and what are the valid values for it?

(also, if this is not where ‘Notes’ is, please let me know!)

Hi!

You are right, the notes are annotations :slight_smile:
You can get the comments using this query: https://github.com/meedan/check/wiki/GraphQL-query-examples#get-comments-of-an-item

“Annotation” refers to any user-created content that is added to an item. Each type of content has a different annotation_type. Some examples: comment, task, tag, flag

Hi Daniela,

For some reason, when I try this query locally, I get the following error. The error does not occur when I use the API key on GraphiQL to run the query.

Exception: Server error on GQL query:
query {
          project_media(ids: "381582") {
            annotations(annotation_type: "comment") {
              edges {
                node {
                  ... on Comment {
                    text
                  }
                }
              }
            }
          }
        }
Error:
{'code': 3, 'locations': [{'column': 2, 'line': 1}], 'message': "Couldn't find ProjectMedia with 'id'=0", 'path': ['project_media']}

Hi Vyoma,

This happens when the query doesn’t include the team. In other topic I suggested you to send a full query (Local vs. GraphiQL).

But you also can send the specific query you want and get the correct data sending the team slug in the URL, like this:
https://check-api.checkmedia.org/api/graphql?team=your_team_slug
Replacing your_team_slug by the team you are working with.

1 Like