Forum Discussion

sanjay91422's avatar
sanjay91422
Contributor
2 months ago

Facing issue with createTkbArticle GraphQL mutation

Hi, 

I am using the client credentials to make a server to server GraphQL api call to create a tkb article in one of the tkb board.  But I am getting the following Error, for which I see no discussion in the forum or docs. Even Google doesn't show any results. 

Errors: [

  {

    "message": "Exception while fetching data (/createTkbArticle) : lithium.util.NullArgumentException: defaultErrorType",

    "locations": [

      {

        "line": 2,

        "column": 3

      }

    ],

    "path": [

      "createTkbArticle"

    ],

    "extensions": {

      "classification": "DataFetchingException"

    }

  }

]

I am making the call from a node-express app, and just in case if it helps I am sharing the code snippet :

const createTKBArticleMutation = `

mutation createTkbArticle($createInput: CreateTkbArticleInput!) {

createTkbArticle(createInput: $createInput) {

result {

id

}

errors {

__typename

... on NotValidPossibleValueError {

message

}

... on PermissionDeniedError {

message

}

... on InvalidHtmlError {

message

}

... on CustomFieldNotDefinedForEntityError {

message

}

... on RequiredCustomFieldNotSet {

message

}

}

}

}

`;

 

const createTKBArticleVariables = {

createInput: {

subject: "Testing GraphQL TKB creation",

body: "This article is created using GraphQL API, for testing the API itself.",

// teaser: "This is a test teaser for the TKB article",

// introduction: "This is a test introduction for the TKB article.",

board: {

id: "board:knowbler_tkb"

}

}

};

 

const method = 'POST';

 

// const query = fetchTKBBoardsQuery;

const query = createTKBArticleMutation;

const options = {

url: GRAPHQL_ENDPOINT,

method: method,

headers: {

Authorization: `Bearer ${creds.accessToken}`,

'Content-Type': 'application/json'

},

data: JSON.stringify({

query: query,

variables: createTKBArticleVariables

})

};

 

const response = await axios(options);

No RepliesBe the first to reply