Not able to create Space using Rest API
Asked by PASUPULA REDDY:

Hi,

I am having the permission to create space in Confluence but I am not able to do the same using Rest API in Jmeter.

Received Error is 403 - Forbidden Error.

It would be helpful if you provide header manager content.

Regards,

Kulasekhar


Answers:
author: Minh Tran
body: [@PASUPULA REDDY](/t5/user/viewprofilepage/user-id/3018152) It is very hard to provide the help with less information.

Can you please let me know if you can call REST api successfully outside JMeter? What is the exact command have you run? And what is the one you passed to JMeter? Can you share?

comments: author: PASUPULA REDDY
body: thanks for the response.

I am passing the credentials inside J-meter

PFB Code which i am trying to create the space using Rest Api in j-meter and the method calling is "post".

{

"key": "TST_CONF",  
"name": "APT_Confluence",  
"description": {  
"plain": {  
"value": "This is an example space",  
"representation": "plain"  
}  
},  
"metadata": {}  
}

And also, posting the error code below.

{"statusCode":403,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":\[\],"successful":false},"message":"Cannot create Space","reason":"Forbidden"}.


author: PASUPULA REDDY
body: And also adding additional info here

https://localhost:8095/rest/api/space - this rest api path I am calling inside J-meter


author: Minh Tran
body: [@PASUPULA REDDY](/t5/user/viewprofilepage/user-id/3018152) Can you try to make it work without Jmeter first? I suspect your account does not have enough permission to create space

That is why the status code returns 403


author: PASUPULA REDDY
body: I have created the space successfully by physically, i don't think its space permission issue. can you please guide us how to resolve above mentioned issue.


author: Minh Tran
body: [@PASUPULA REDDY](/t5/user/viewprofilepage/user-id/3018152) What exact Confluence Server version are you using?

Can you please give me a sample curl command that could not create the space for you?


author: PASUPULA REDDY
body: Confluence 7.2.0 - this is the confluence version currently we are using and we are not using any kind of curl command.

We are using below code to create space using rest api.

{

"key": "TST_CONF",  
"name": "APT_Confluence",  
"description": {  
"plain": {  
"value": "This is an example space",  
"representation": "plain"  
}  
},  
"metadata": {}  
}

Method I used is "POST"


author: Minh Tran
body: Ok, if you don't use curl. Can you give me the complete source code that you use to create space?

I need something to troubleshoot why you can't create space


author: PASUPULA REDDY
body: We are using below code to create space using rest api.

{

"key": "TST_CONF",  
"name": "APT_Confluence",  
"description": {  
"plain": {  
"value": "This is an example space",  
"representation": "plain"  
}  
},  
"metadata": {}  
}

Method I used is "POST"


author: Minh Tran
body: [@PASUPULA REDDY](/t5/user/viewprofilepage/user-id/3018152) That does not help me in understanding how you create the REST call :)

I want to know exact code snippet that you used to create the REST call to Confluence what problem you have really experienced so i can provide the instruction or troubleshooting


author: PASUPULA REDDY
body: Hi,

When you work with Confluence from browser you can see on top right menu items to export current page as Word or PDF. What is an equivalent to make similar export from REST API? Thank you very much in advance


Tags: confluence-server

server