Strapi GraphQL Queries and Mutations Documentation

Hello, I created a Github repository that contains a collection of GraphQL queries and mutations that you can use in your Strapi app. It covers Registration, Login, CRUD operations, and Image Uploads (both Single and Multiple Images whose approaches can be used to upload file). It is called Strapql and if you are interested, please check it out here : GitHub - kevinadhiguna/strapi-graphql-documentation: Collections of queries and mutations that hopefully h. Also, if you have any requests regarding to queries, mutations, or even subscription using GraphQL, feel free to create an issue so I can work on them, thanks :slight_smile:

9 Likes

Good job, thanks. Saved it in my bookmarks :slight_smile:

1 Like

Thanks a lot!

1 Like

@meganelacheny / @piwi maybe we should add some of these to the official docs when we refactor the GQL one :stuck_out_tongue:

3 Likes

Great job, Marc, thanks for your contribution!
Will have a deeper look at this soon :wink:

1 Like

Thanks a lot @DMehaffy and @piwi :slight_smile:
Hopefully I can make it better

Thanks @marc

1 Like

My pleasure! @Venkata_Penumatsa

Wow, this is amazing! Great job. Super useful, especially the image upload mutations. Def saving these for later reference.

1 Like

Thank you ! @Krislunde

Very useful !
Thank you

1 Like

Hi Marc,
could you help me by an ex. of strapi/graphql mutations using react useMutation hook? could not find a way to deploy that. for ex. i built a simple blog collection using strapi and i would like the frontend users to add data to that data collection. so i need an input field , an function “talking” with the useMutation hook.
Cheers

For v4 upload mutation
Use Altair for File upload because default GQL playground doesnt support that

mutation SingleImageUpload($refId: ID, $ref: String, $field: String, $info: FileInfoInput, $file: Upload!) {
   upload(refId: $refId, ref: $ref, field: $field, file: $file, info: $info) {
     data {
       id
       attributes {
         name   
         createdAt
         updatedAt
       }
     }
   }
}
{
  "refId": "2",
  "ref": "api::physical-exchanger.physical-exchanger",
  "field": "photo",
  "info": {
      "name":"test",
      "alternativeText": "",
      "caption": "`"
  }
}

“refId”: “ID_OF_YOUR_ENTRY_IN_YOUR_COLLECTION_TYPE”,

“ref”: “YOUR_COLLECTION_TYPE_NAME”,

“field”: “FIELD_NAME”