Closed triffid closed 3 years ago
The API is self-documented using GraphQL. You can go to /graphql
on your installation to launch the GraphQL Playground. You can build queries from there and see the full documentation on the right.
A list of functions and parameters is hardly documentation, and it offers zero clue why I might be getting "Cannot read property 'map' of undefined" back from the server for what seems like a fairly simple query.
I've also ran across this issue and it seems to be a bug. It goes away when you declare the id argument as a Int! type variable and pass it to the mutation like so:
mutation Page(
$id: Int!
$content: String!
$description: String!
$tags: [String]!
$title: String!
$isPublished: Boolean!
) {
pages {
update(
id: $id
content: $content
description: $description
tags: $tags
title: $title
isPublished: $isPublished
) {
responseResult {
succeeded
errorCode
slug
message
}
page {
id
path
title
}
}
}
}
VARS
{
"id": 21,
"content": "HELLO WORLD!",
"title": "page title",
"description": "page description",
"tags": ["patching", "maintenance"],
"isPublished": true
}
Describe the bug Getting " Cannot read property 'map' of undefined" for page update mutations
To Reproduce Feeding
into https://my-wiki-host/graphql via web browser gives me
Which seems like either an internal error, or a message that's just as obtuse as the one that appears when I forget to put the authorization token into http headers.
Expected behavior Either page text gets changed, or receive a meaningful error message that suggests the proper way to do it.
Host Info (please complete the following information):
Additional context I'm having a terrible time trying to find any documentation for this API - seems like there's a machine-readable schema but no tutorials or examples anywhere, so I'm left stumbling about in the dark trying to guess what query format I need to do what I want.