Skip to content

Example mutations

Example 1 - Login

This will return a token to be used for mutations and queries that require an authenticated user. Keep a copy of the generated token which is good by default for 7 days. After 7 days, you will need to login again to generate another token.

Image link

mutation {
  login(login: "Admin", email: "admin@deepsea-ai.org", password: "gulpereel") {
    token
  }
}

Copy the token to the section REQUEST HEADERS in the Bearer field, e.g.  Image link

{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV..."
}

Example 2 - Add a machine learning class and its associated concept

This requires an authenticated user token.

The mutation string:

mutation {
  addClass( 
    name: "Nanomia_bijuga",  
    concept: "Nanomia bijuga"
  )
  {
    success
    message
  }
}

Example 3 - Delete all tracks for a given media

This requires an authenticated user token.

The mutation string:

mutation {
  deleteTracksByMedia(media_id: 1)
  {
    success
    message
  }
}

Example 4 - Modify a concept for a given track by its unique identifier

This requires an authenticated user token.

mutation {
  changeTrackByUuid(uuid: "621c0a78-316f-458f-933a-5d2f9e4f432b", concept: "kelp")  {
    success
    message
  }
}