How Do I Recover My Extension After Deleting the Project?

Even after deleting a project, you can still recover your deployed extension's source files, if needed. Use the script provided below to retrieve the source files, which you can then import into a new workspace for continued testing and configuration work.

To do this, you'll need these details:
  • The deployed extension ID and extension version

    (If you need help finding this information, file a service request and include as many details about your deployed extension as possible, such as the base application you're configuring and deployment date.)

  • The URL of the environment where the extension was deployed
  • Credentials of a user who can access the Oracle Cloud Applications instance

You'll also need to be able to edit and run a Python script, or use curl to duplicate what the Python script does.

  1. Copy this Python script and save it as getDeployedExtension.py:
    import json
    import requests
    from requests.auth import HTTPBasicAuth
    import os
    
    #get extension file list
    response = requests.get('https://myoraclecloudappsinstance.fa.ocs.oraclecloud.com/fscmRestApi/vx/v2/extensions/Extension_ID/Extension_version',auth=('username','password'))
    
    response_dict = response.json()
    print(json.dumps(response_dict, indent=4)) #pretty print the json received through the above GET cmd
    
    #write a shell script file containing the curl commands to download the necessary extension files, while recreating the exact directory structure of the deployed extension
    if os.path.exists("curlFile.sh"): os.remove("curlFile.sh")
    baseURL=response_dict["baseUrl"]
    for x in response_dict["files"]:
      # ignore files in the extension-digest folder and bundles folder, and ignore build-info.json.
      if not (("bundle" in x) or ("build-info.json" in x) or ("extension-digest" in x)):
        with open('curlFile.sh', 'a', encoding="utf-8") as f:
          f.write("curl -u \"username:password\" --create-dirs -o " + response_dict["id"] + "/" + response_dict["version"] + "/" + "sources" + "/" +  x  + " " + baseURL + "/" + x + "\n\n")
    
    #run the shell script
    os.system("sh curlFile.sh")
  2. In the script, replace the environment URL, Extension_ID, Extension_version, username, and password with your extension-specific values.
  3. Run the script (recommended version is Python 3). For example:
    python3 getDeployedExtension.py
    The script creates a directory structure for the extension and extracts the source files into a sources subdirectory.
  4. Create a .zip file of the sources subdirectory, only.

    Note:

    On a Mac, don't use the Finder to do this because it will create an archive that's incompatible with VB Studio.
  5. In VB Studio, create a workspace with a scratch Git repository. We're using a scratch repository in this example, but you can use any Git repository that fits your own best practices.
  6. Open the Source tab, right-click extension1, and click Import to import the sources.zip file into your workspace.


    The extension is now available in VB Studio for testing and validation.