Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Get a list of all Categories

Query:

Code Block
query categories($order: [QueryCategoriesOrderByOrderByClause!], $first: Int!, $page: Int, $status: [String], $search: QueryCategoriesSearchWhereConditions) { categories( orderBy: $order search: $search status: $status first: $first page: $page ) { paginatorInfo { total count currentPage } data { id title videoAmount carouselAmount playlistAmount createdAt updatedAt status videos { id thumbnail { urlByDimensionKey(key: "small") } name createdAt updatedAt duration } carousels { title createdAt updatedAt slideDuration slideCount video { id name thumbnail { urlByDimensionKey(key: "small") } } } playlists { id name thumbnail { urlByDimensionKey(key: "small") } createdAt updatedAt duration } } } }

Query variables:

Code Block
{ "first": 10, "order": [ { "column": "CREATED_AT", "order": "DESC" }, { "column": "ID", "order": "ASC" } ], "search": { "OR": [ { "column": "TITLE", "value": null, "operator": "LIKE" }, { "column": "ID", "value": "" } ] }, "page": 1, "status": [ "active", "archived" ] }

Code Example:

Code Block
const axios = require("axios");

const url = 'https://manage.aniview.com/api/token?format=json';
const payload = {
    "operationName": "categories",
    "variables": {
        "first": 10,
        "order": [
            {
                "column": "CREATED_AT",
                "order": "DESC"
            },
            {
                "column": "ID",
                "order": "ASC"
            }
        ],
        "search": {
            "OR": [
                {
                    "column": "TITLE",
                    "value": null,
                    "operator": "LIKE"
                },
                {
                    "column": "ID",
                    "value": ""
                }
            ]
        },
        "page": 1,
        "status": [
            "active",
            "archived"
        ]
    },
    "query": "query categories($order: [QueryCategoriesOrderByOrderByClause!], $first: Int!, $page: Int, $status: [String], $search: QueryCategoriesSearchWhereConditions) {\n  categories(\n    orderBy: $order\n    search: $search\n    status: $status\n    first: $first\n    page: $page\n  ) {\n    paginatorInfo {\n      total\n      count\n      currentPage\n    }\n    data {\n      id\n      title\n      videoAmount\n      carouselAmount\n      playlistAmount\n      createdAt\n      updatedAt\n      status\n      videos {\n        id\n        thumbnail {\n          urlByDimensionKey(key: \"small\")\n        }\n        name\n        createdAt\n        updatedAt\n        duration\n      }\n      carousels {\n        title\n        createdAt\n        updatedAt\n        slideDuration\n        slideCount\n        video {\n          id\n          name\n          thumbnail {\n            urlByDimensionKey(key: \"small\")\n          }\n        }\n      }\n      playlists {\n        id\n        name\n        thumbnail {\n          urlByDimensionKey(key: \"small\")\n        }\n        createdAt\n        updatedAt\n        duration\n      }\n    }\n  }\n}"
}
axios.post(url, {
    'id': 'id',
    'password': 'password',
    'accountId': 'accountId'
})
    .then((response) => {
        apiCall(response.data);
    }, (error) => {
        console.log(error);
    });

function apiCall(auth) {
    axios({
        url: 'https://cms.manage.aniview.com/backend/graphql/',
        method: 'post',
        headers: {
            'Cookie': 'token=' + auth.data.token
        },
        data: payload
    }).then((result) => {
        console.log(result.data[0]);
    });
}

2. Create Categorie

Create a new Categorie

Query:

Code Block
mutation createCategory($input: CategoryTitleInput!) { createCategory(input: $input) { id title } }

Query variables:

Code Block
{ "input": { "title": "TEST" } }

Code Example:

Code Block
const axios = require("axios");

const url = 'https://manage.aniview.com/api/token?format=json';
const payload = {
    "operationName": "createCategory",
    "variables": {
        "input": {
            "title": "TEST"
        }
    },
    "query": "mutation createCategory($input: CategoryTitleInput!) {\n  createCategory(input: $input) {\n    id\n    title\n  }\n}"
}
axios.post(url, {
    'id': 'id',
    'password': 'password',
    'accountId': 'accountId'
})
    .then((response) => {
        apiCall(response.data);
    }, (error) => {
        console.log(error);
    });

function apiCall(auth) {
    axios({
        url: 'https://cms.manage.aniview.com/backend/graphql/',
        method: 'post',
        headers: {
            'Cookie': 'token=' + auth.data.token
        },
        data: payload
    }).then((result) => {
        console.log(result.data[0]);
    });
}

3. Update Categorie

Update a specific Categorie

Query:

Code Block
mutation updateCategory($input: CategoryUpdateTitleInput!) { updateCategory(input: $input) { id title } }

Query variables:

Code Block
{ "input": { "id": "62f349690b0357ed20019514", "title": "TEST123" } }

Code example:

Code Block
const axios = require("axios");

const url = 'https://manage.aniview.com/api/token?format=json';
const payload = {
    "operationName": "updateCategory",
    "variables": {
        "input": {
            "id": "62f349690b0357ed20019514",
            "title": "TEST123"
        }
    },
    "query": "mutation updateCategory($input: CategoryUpdateTitleInput!) {\n  updateCategory(input: $input) {\n    id\n    title\n  }\n}"
}
axios.post(url, {
    'id': 'id',
    'password': 'password',
    'accountId': 'accountId'
})
    .then((response) => {
        apiCall(response.data);
    }, (error) => {
        console.log(error);
    });

function apiCall(auth) {
    axios({
        url: 'https://cms.manage.aniview.com/backend/graphql/',
        method: 'post',
        headers: {
            'Cookie': 'token=' + auth.data.token
        },
        data: payload
    }).then((result) => {
        console.log(result.data[0]);
    });
}

4. Delete Categorie

Delete a specific Categorie

Query:

Code Block
mutation archiveCategoriesMutation($ids: [ID!]!) { archiveCategory(ids: $ids) { id } }

Query variables:

Code Block
{ "ids": [ "62f349690b0357ed20019514" ] }

Code example:

Code Block
const axios = require("axios");

const url = 'https://manage.aniview.com/api/token?format=json';
const payload = {
    "operationName": "archiveCategoriesMutation",
    "variables": {
        "ids": [
            "62f349690b0357ed20019514"
        ]
    },
    "query": "mutation archiveCategoriesMutation($ids: [ID!]!) {\n  archiveCategory(ids: $ids) {\n    id\n  }\n}"
}
axios.post(url, {
    'id': 'id',
    'password': 'password',
    'accountId': 'accountId'
})
    .then((response) => {
        apiCall(response.data);
    }, (error) => {
        console.log(error);
    });

function apiCall(auth) {
    axios({
        url: 'https://cms.manage.aniview.com/backend/graphql/',
        method: 'post',
        headers: {
            'Cookie': 'token=' + auth.data.token
        },
        data: payload
    }).then((result) => {
        console.log(result.data[0]);
    });
}