Confluence CLI: exportSpace : Bad response code 403
Asked by Regis:

Hi Guys

I have CLI version 3.7.0, and Confluence 5.4.1.

I'm trying to export a space (not that big, about 7Mb when exported with Confluence in PDF).

I tried first exporting it in PDF, but it ends the with:

*Remote error: ; nested exception is:*

*java.net.SocketTimeoutException: Read timed out*  
The connexion time out being valued with 10mn, ok, I can understand. Thus, I try an XML export, but then I get the error above mentioned.  
--  
--  
***confluence-cli/confluence.sh -s <https://atlassian.hq.k.grp/confluence>-u adminatl -p XXXXX -a exportSpace --space CMADMINTEAM --file "/tmp/toto.zip" -v***  
*Server address: <https://atlassian.hq.k.grp/confluence/rpc/soap-axis/confluenceservice-v1>*  
*Successful login to: <https://atlassian.hq.k.grp/confluence/rpc/soap-axis/confluenceservice-v1>by user: adminatl.*  
*Server address: <https://atlassian.hq.k.grp/confluence/rpc/soap-axis/confluenceservice-v2>*  
*Successful login to: <https://atlassian.hq.k.grp/confluence/rpc/soap-axis/confluenceservice-v2>by user: adminatl.*  
*Action requires v2 remote API level. Service automatically updated to v2.*  
*Using basic authentication.*  
*17388b8f49 logged out.*  
***Client error: Bad response code (403) received trying to retrieve data from URL:** <https://atlassian.hq.k.grp/confluence/download/temp/Confluence>space export-075859-99.xml.zip*  
*org.swift.common.cli.CliClient$ClientException: Bad response code (403) received trying to retrieve data from URL: <https://atlassian.hq.k.grp/confluence/download/temp/Confluence>space export-075859-99.xml.zip*  
*at org.swift.common.cli.CliUtils.copyUrlToFile(CliUtils.java:215)*  
*at org.swift.confluence.cli.ConfluenceClient.exportSpace(ConfluenceClient.java:4724)*  
*at org.swift.confluence.cli.ConfluenceClient.handleRequest(ConfluenceClient.java:656)*  
*at org.swift.common.cli.AbstractRemoteClient.process(AbstractRemoteClient.java:122)*  
*at org.swift.common.cli.CliClient.doWork(CliClient.java:388)*  
*at org.swift.confluence.cli.ConfluenceClient.main(ConfluenceClient.java:143)*  
--  
-- In the Confluence logs, I can read:  
*2014-01-24 07:57:37,431 INFO \[http-chx-atlcorp-04.hq.k.grp%2F10.0.92.152-8090-78\] \[confluence.rpc.auth.TokenAuthenticationInvocationHandler\] invokeAuthenticatedMethod Executing remote API method \[ getServerInfo \] as user \[ adminatl \]*  
*2014-01-24 07:57:37,823 INFO \[http-chx-atlcorp-04.hq.k.grp%2F10.0.92.152-8090-47\] \[confluence.rpc.auth.TokenAuthenticationInvocationHandler\] invokeAuthenticatedMethod Executing remote API method \[ exportSpace \] as user \[ adminatl \]*  
*2014-01-24 07:57:37,898 INFO \[http-chx-atlcorp-04.hq.k.grp%2F10.0.92.152-8090-47\] \[atlassian.confluence.upgrade.AbstractUpgradeManager\] getExportBuildNumber Backward compatibility for export: Checking...*  
*2014-01-24 07:57:37,900 INFO \[http-chx-atlcorp-04.hq.k.grp%2F10.0.92.152-8090-47\] \[atlassian.confluence.upgrade.AbstractUpgradeManager\] getExportBuildNumber Build number 4526: "Remove the legacy remotable apps plugin from the user installed plugins" - Ok*  
*2014-01-24 07:57:37,902 INFO \[http-chx-atlcorp-04.hq.k.grp%2F10.0.92.152-8090-47\] \[atlassian.confluence.upgrade.AbstractUpgradeMana ger\] getExportBuildNumber Build number 4517: "Migrate all Page Templates using a storage format round-trip conversion" - Not Ok*  
*2014-01-24 07:57:37,905 INFO \[http-chx-atlcorp-04.hq.k.grp%2F10.0.92.152-8090-47\] \[atlassian.confluence.upgrade.AbstractUpgradeManager\] getExportBuildNumber Backward compatibility for export: "Migrate all Page Templates using a storage format round-trip conversion" prevents compatibility before 4517*  
*2014-01-24 07:59:03,107 ERROR \[http-chx-atlcorp-04.hq.k.grp%2F10.0.92.152-8090-111\] \[confluence.servlet.download.ExportDownload\] getStreamForDownload Unauthorized attempt to access resource by adminatl. For more detail turn on INFO level logging for package : com.atlassian.confluence.servlet.download*  
*-- url: /confluence/download/temp/Confluence \| userName: adminatl*  
--  
--  
Any idea where it comes from?  
Thanks for your help  
Regis


Answers:
author: Bob Swift (personal)
body: 1. For the timeout, see the [connectionTimeout](https://bobswift.atlassian.net/wiki/display/CSOAP/Documentation#Documentation-connectionTimeout) parameter
2. For the download error, that is a Confluence problem that appeared in 5.4.1 and is fixed in 5.4.3 - [CONF-32094](https://jira.atlassian.com/browse/CONF-32094). Also [ACLI Release 3.8](https://bobswift.atlassian.net/wiki/display/ACLI/Release+notes+3.8) implemented a workaround.


author: Jonas Andersson
body: Hi Bob,

We are getting "***Client error: Bad response code (403) received trying to retrieve data from URL***" when trying to export a space too, and this on confluence 5.5.. We use confluence-cli-3.9.0.jar Might the same bug have resurfaced?


Tags: cli