Update content API - Not working

Søren Dahl Poulsen June 16, 2022

Hi all! 

I am attempting to update the content of a page using REST api. 

I am calling this endpoint using PUT: http://domain/wiki/rest/api/content/3906240556

With this payload: 

{

    "id"3906240556,

    "type""page",

    "space": {

        "key""PK"

    },

    "body": {

        "title""NEW TITLE",

        "storage": {

            "value""test test test",

            "representation""storage"

        }

    },

    "version": {

        "number"5

    }

}

I get a response "200 OK", but nothing is actually updated on the page itself. I can't figure out why that is. Does anyone have any pointers as to what might be the issue? 

1 answer

1 accepted

0 votes
Answer accepted
Jessica
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 5, 2022

Hi @Søren Dahl Poulsen 

Welcome to the Atlassian Community!

I have tried the same endpoint you used, but if my title is inside the body for example, it doesn't allow me to update and there is no 200 OK for me.
I'm following this documentation REST API - Update comment

So, I'd like to ask you to test running something like this, when trying to update the page:

 {
"version": {
"number": 5
},
"type": "page",
"status": "current",
"title": "NEW TITLE",
"space": {
"key": "PK"
},
"body": {
"storage": {
"value": "test test test",
"representation": "storage"
}
}
}

That should do the trick!

If that still doesn't work, would you mind sharing the body response?
Also, keep in mind to use https:// instead of http:// :)

Cheers,
Jessica

Daniel Schmidt July 6, 2022

Hi Jessica

I am fighting with the same problem like @Søren Dahl Poulsen

The title will be updated, but the value (page content) is not changing?

Could you please check again on your side.

Here is my Body:

{
"version": {
"number": 11
},
"type": "page",
"status": "current",
"title": "New page update by API",

"storage": {
"value": "test daniel",
"representation": "storage"
}
}

The value has no function?

BR

Daniel 

Jessica
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 6, 2022

Hi @Daniel Schmidt 

The value has function and I can confirm to you it works, but in your case, it seems it is not really inside the body, like in the example above or in the REST API - Update comment documentation examples, so this seems what is going wrong there.

From what I can see, the storage and value, should be after the body, which there isn't any in your example.

Could you try this one?

{
"version": {
"number": 12
},
"title": "New page update by API",
"type": "page",
"body": {
"storage": {
"value": "test daniel",
"representation": "storage"
}
},
}

Hope this helps.
Jessica

Søren Dahl Poulsen July 11, 2022

@Jessica Moving title outside of body and adding using "https" did the trick for me. Thanks! 

Like Jessica likes this
Daniel Schmidt July 12, 2022

Hi @Jessica 

Sorry for my late reply to you.

Your JSON format is working fine for me.

Thanks!

BR Daniel

{
"version": {
"number": 12
},
"title": "New page update by API",
"type": "page",
"body": {
"storage": {
"value": "test daniel",
"representation": "storage"
}
},
}
Like Jessica likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events