Unexpected end of json input on rest api for Ui modification update

Hi there,

The ui modification update api returns following error while i try to update the UI Modification

ERROR   11:56:09.396  992cea571ebe88dc  Unexpected end of JSON input
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.json (bootstrap.js:1:4224)
    at /tmp/tunnel83Zah2YEdAOGH/index.js:39415:18
    at async resolve (webpack://issue-template-for-jira/node_modules/@forge/resolver/out/index.js:53)

Here is the codesnippet I am using to update the UiModification :slight_smile:

resolver.define("updateUiModificationV2", async ({ payload }) => {
  try {
    const { contexts, uiModficationId } = payload

    const result = await api
      .asApp()
      .requestJira(route`/rest/api/3/uiModifications/${uiModficationId}`,
        {
          method: "PUT",
          body: JSON.stringify({contexts: contexts}),
          headers: {
            'Content-Type': 'application/json',
            Accept: 'application/json'
          }
        });

    await result.json()
    return true
  } catch (error) {
    console.error(`Error updating UI Modification : ${error}`)
    throw error
  }
})

2 Likes