Uploaded image for project: 'Jira Platform Cloud'
  1. Jira Platform Cloud
  2. JRACLOUD-67169

JIRA backup script returns 404 in the new infrastructure

       Please notice that this only applies to the new infrastructure. The old endpoints are still working fine in the old infrastructure

      Summary

      Running a JIRA backup from command line or from a script fails. The endpoint rest/obm/1.0/runbackup is now returning: 404 - page not found

      As mentioned in the KB article "How to Automate Backups for JIRA Cloud applications" this is not fully supported but, if the endpoint has been removed, then we should either update the documentation or make it work again.

      Steps to Reproduce

      1. Either use the Atlassian Labs automatic-cloud-backup script or run the below commands:
        curl -D- -c cookie.txt -H "Content-Type: application/json" -d '{"username":"EMAIL", "password":"PASSWORD" }' -X POST https://HOSTNAME/rest/auth/1/session
        
        curl --cookie cookie.txt --header "X-Atlassian-Token: no-check" -H "X-Requested-With: XMLHttpRequest" -H "Content-Type: application/json"  -X POST https://HOSTNAME/rest/obm/1.0/runbackup -d '{"cbAttachments":"true" }'  
        

      Expected Results

      A JIRA backup is started and you can check the progress by calling the below endpoint:

      curl --cookie cookie.txt https://HOSTNAME/rest/obm/1.0/getprogress.json
      

      Actual Results

      An error is returned instead:

      curl --cookie cookie.txt --header "X-Atlassian-Token: no-check" -H "X-Requested-With: XMLHttpRequest" -H "Content-Type: application/json"  -X POST https://HOSTNAME/rest/obm/1.0/runbackup -d '{"cbAttachments":"true" }' 
      
      
      <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Oops, you&#39;ve found a dead link. - JIRA</title><script type="text/javascript">contextPath = "";</script><link type='text/css' rel='stylesheet' href='/static-assets/metal-all.css' media='all'><script src='/static-assets/metal-all.js'></script><!--[if lt IE 9]><link type='text/css' rel='stylesheet' href='/static-assets/metal-all-ie.css' media='all'><script src='/static-assets/metal-all-ie.js'></script><![endif]--><!--[if IE 9]><link type='text/css' rel='stylesheet' href='/static-assets/metal-all-ie9.css' media='all'><![endif]--><meta name="decorator" content="none" /></head><body class=" error-page error404"><script type="text/javascript">document.body.className += " js-enabled";</script><div id="page"><header id="header" role="banner"></header><!-- #header --><section id="content" role="main"><div class="aui-page-panel"><div class="aui-page-panel-inner"><section class="aui-page-panel-content lowerContent"><div id="error-state"><span class="error-type"></span><h1>Oops, you&#39;ve found a dead link.</h1><ul><li>Go back to the <a href="javascript:window.history.back()">previous page</a></li><li>Go to the <a href="/secure/MyJiraHome.jspa">Home Page</a></li></ul></div></section><!-- .aui-page-panel-content --></div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel --></section><!-- #content --><footer id="footer" role="contentinfo"><section class="footer-body"><div id="footer-logo"><a href="http://www.atlassian.com/" rel="nofollow">Atlassian</a></div></section></footer><!-- #footer --></div><!-- #page --></body></html>
      

      Workaround

      There are new endpoints to be called that are working fine. However, please notice that automatic backup from script is not officially supported and therefore the endpoints can change again in the future without any previous notice.

      I have updated the existing script by doing the following (you can do the same in case the scripts won't work anymore in the future):

      1. Open the developer tools in Chrome (or Firefox)
      2. Run the backup from the UI
      3. In the developer console check the endpoints used to run the backup and modify the existing scripts accordingly

      Below are the scripts I have just used to backup my JIRA and Confluence instances. Please use them at your own risk (and make sure you read and understand what's in there before running them):

            [JRACLOUD-67169] JIRA backup script returns 404 in the new infrastructure

            Hi All,

            We are closing this issue as a duplicate of https://jira.atlassian.com/browse/CLOUD-6498, the feature request for Supporting Automated backups in Jira Cloud. Please follow along on this issue for future updates.

            Please note, we have documented a workaround and provided scripts but this feature is not currently supported. Please use at your own risk.

            Regards,
            Eric

            Eric S (Inactive) added a comment - Hi All, We are closing this issue as a duplicate of https://jira.atlassian.com/browse/CLOUD-6498 , the feature request for Supporting Automated backups in Jira Cloud. Please follow along on this issue for future updates. Please note, we have documented a workaround and provided scripts but this feature is not currently supported. Please use at your own risk. Regards, Eric

            Dario B added a comment -

            Hi stefan.engeli,

            I have run the script as it is and it worked for me. Only:

            1. You must have Jira and Confluence in the same instance in order for the script to work
            2. The account used in the script must have Confluence application access.

            Also, the script is creating the jiracookie by itself (when creating the session) and removing it once the script is done. Maybe I can change that part... However, without any path the cookie is saved in the same location from which the script is running.

            Let me know if this still not work for you and I will test it again (and maybe change the cookie part a bit).

             

            Cheers,
            Dario

            Dario B added a comment - Hi stefan.engeli , I have run the script as it is and it worked for me. Only: You must have Jira and Confluence in the same instance in order for the script to work The account used in the script must have Confluence application access. Also, the script is creating the jiracookie by itself (when creating the session) and removing it once the script is done. Maybe I can change that part... However, without any path the cookie is saved in the same location from which the script is running. Let me know if this still not work for you and I will test it again (and maybe change the cookie part a bit).   Cheers, Dario

            Stefan Engeli added a comment - - edited

            Hi dbonotto
            I tried out your scripts you posted, but for Confluence I get {"message":"Client must be authenticated to access this resource.","status-code":401}.
            The Jira script does not return this error at least, so far it seems to be checking every few - staying curious if it'll work.

            My question is, if you have created the jiracookie first by yourself with a tool or did you just run the script without preparing anything? Also did you define a path for the jiracookie or just left the value "jiracookie" without any path declaration?

            Regards, Stefan

            Stefan Engeli added a comment - - edited Hi dbonotto I tried out your scripts you posted, but for Confluence I get {"message":"Client must be authenticated to access this resource.","status-code":401}. The Jira script does not return this error at least, so far it seems to be checking every few - staying curious if it'll work. My question is, if you have created the jiracookie first by yourself with a tool or did you just run the script without preparing anything? Also did you define a path for the jiracookie or just left the value "jiracookie" without any path declaration? Regards, Stefan

            Dario B added a comment -

            Hi ernesto.cejas,

            The endpoints are in the last script I attached to this issue: JIRA-backup-new-endoints-12-2017.sh

             

            As already mentioned in the description the endpoint INSTANCE/rest/obm/1.0/runbackup has been replaced with INSTANCE/rest/backup/1/export/runbackup already some time ago.

            The other endpoint that changed not long ago is /rest/internal/2/task/progress/TASKID that has now been replaced with /rest/backup/1/export/getProgress?taskId=TASKID

            Also, as written in the workaround section:

            I have updated the existing script by doing the following (you can do the same in case the scripts won't work anymore in the future):

            1. Open the developer tools in Chrome (or Firefox)
            2. Run the backup from the UI
            3. In the developer console check the endpoints used to run the backup and modify the existing scripts accordingly

            Below are the scripts I have just used to backup my JIRA and Confluence instances. Please use them at your own risk (and make sure you read and understand what's in there before running them):

            Dario B added a comment - Hi ernesto.cejas , The endpoints are in the last script I attached to this issue: JIRA-backup-new-endoints-12-2017.sh   As already mentioned in the description the endpoint INSTANCE/rest/obm/1.0/runbackup has been replaced with INSTANCE/rest/backup/1/export/runbackup already some time ago. The other endpoint that changed not long ago is /rest/internal/2/task/progress/TASKID that has now been replaced with /rest/backup/1/export/getProgress?taskId=TASKID Also, as written in the workaround section: I have updated the existing script by doing the following (you can do the same in case the scripts won't work anymore in the future): Open the developer tools in Chrome (or Firefox) Run the backup from the UI In the developer console check the endpoints used to run the backup and modify the existing scripts accordingly Below are the scripts I have just used to backup my JIRA and Confluence instances. Please use them at your own risk (and make sure you read and understand what's in there before running them): Confluence-backup.sh JIRA-backup-new-endoints-12-2017.sh

            awtf added a comment -

            @ErnestoCejas you can check my script implementation on what's the latest endpoints - https://github.com/midN/jira-cloud-backuper

            awtf added a comment - @ErnestoCejas you can check my script implementation on what's the latest endpoints -  https://github.com/midN/jira-cloud-backuper

            @DarioBonotto 

            Can you elaborate on "since the endpoints changed again for JIRA"? What changed?

            Now I am getting  "HTTPError: 404 Client Error: Not Found for url: https://\{SITE}.atlassian.net/rest/obm/1.0/runbackup"

            I ask because you should assume that people are not be using your script as it is. I would like to understand the change before rewriting a script. 

            Also, +1 with what @MaryCombs says. I hope you guys know is very disruptive, to say the least, changing an API endpoint used by many. 

            thanks

             

             

            Ernesto Cejas added a comment - @DarioBonotto  Can you elaborate on "since the endpoints changed again for JIRA"? What changed? Now I am getting  "HTTPError: 404 Client Error: Not Found for url: https://\ {SITE}.atlassian.net/rest/obm/1.0/runbackup" I ask because you should assume that people are not be using your script as it is. I would like to understand the change before rewriting a script.  Also, +1 with what @MaryCombs says. I hope you guys know is very disruptive, to say the least, changing an API endpoint used by many.  thanks    

            Yes legal clarification to cover poor quality software for which Atlassian clients pay twice - both monthly and in labor costs to keep updated every few months.

            Marty Combs added a comment - Yes legal clarification to cover poor quality software for which Atlassian clients pay twice - both monthly and in labor costs to keep updated every few months.

            Dario B added a comment -

            Hi marty.combs323296794,

            As mentioned in the workaround section:

            please notice that automatic backup from script is not officially supported and therefore the endpoints can change again in the future without any previous notice.

            I hope this clarifies.

            Dario B added a comment - Hi marty.combs323296794 , As mentioned in the workaround section: please notice that automatic backup from script is not officially supported and therefore the endpoints can change again in the future without any previous notice. I hope this clarifies.

            This makes three times in the past year in which we have had to spend time downloading yet another backup script or update our existing scripts because Atlassian has changed URLs within their API. 

            First we were using:

            /rest/obm/1.0/getprogress.json

            Then we were asked to use

            /rest/internal/2/task/progress/${TASKID}

            Now it is

            /rest/backup/1/export/getProgress?taskId=${TASKID}

            We do not pay Atlassian thousands of dollars monthly only to spend yet more money in expensive labor hours to keep updating our backup scripts due to Jira's amateurish approach to software development.  Do your QA testing before releasing your code.

             

            Marty Combs added a comment - This makes three times in the past year in which we have had to spend time downloading yet another backup script or update our existing scripts because Atlassian has changed URLs within their API.  First we were using: / rest /obm/1.0/getprogress.json Then we were asked to use / rest /internal/2/task/progress/${TASKID} Now it is / rest /backup/1/export/getProgress?taskId=${TASKID} We do not pay Atlassian thousands of dollars monthly only to spend yet more money in expensive labor hours to keep updating our backup scripts due to Jira's amateurish approach to software development.  Do your QA testing before releasing your code.  

            I find it very disturbing that the Cloud product was recommended to me and there is no automated backup for it. For all kinds of stupid integration there is a plugin for integration, but not for backups. That's exactly what the cloud should enable us to do.

            Dieter Granitzki added a comment - I find it very disturbing that the Cloud product was recommended to me and there is no automated backup for it. For all kinds of stupid integration there is a plugin for integration, but not for backups. That's exactly what the cloud should enable us to do.

              Unassigned Unassigned
              dbonotto Dario B
              Affected customers:
              29 This affects my team
              Watchers:
              45 Start watching this issue

                Created:
                Updated:
                Resolved: