Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

using curl to query package manager for location of package under /etc/packages

Avatar

Level 2

Uploaded/installed packages are placed in function specific folders.

 

How can I query via curl to get the folder location?

 

I would hate to have to install/locate manually to get that location before replicating.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Packages are always grouped based on 'group' property of the package. For example, core components have mentioned group as 'adobe/cq60' and is placed at /etc/packages/adobe/cq60/core.wcm.components.config-2.2.2.zip

 

If you want the full list of packages you can use the package list API at  http://localhost:4502/crx/packmgr/list.jsp

View solution in original post

6 Replies

Avatar

Correct answer by
Employee Advisor

Packages are always grouped based on 'group' property of the package. For example, core components have mentioned group as 'adobe/cq60' and is placed at /etc/packages/adobe/cq60/core.wcm.components.config-2.2.2.zip

 

If you want the full list of packages you can use the package list API at  http://localhost:4502/crx/packmgr/list.jsp

Avatar

Employee Advisor

You can use the GET command below:

 

 http://<host>:<port>/etc/packages/my_packages.infinity.json

 

Where "my_packages" is one of the folders under /etc/packages where packages will be stored. You can replace this with your custom folder name.

Avatar

Level 2
I am able to use curl to upload/install packages. My issue is in how to use the requests module of Python v3.

Avatar

Level 1

To find the folder location of uploaded or installed packages programmatically, you can use a curl command to query the relevant endpoint if your environment supports API access to retrieve this information. Here are some general steps:

  1. Identify the API Endpoint:

    • Check your server's API documentation for an endpoint that lists installed packages or deployed resources. Common endpoints often include /packages, /modules, or /deployments, and may provide a list of installed packages along with their paths.
  2. Use curl to Query the API:

  3. Filter for Folder Locations:

    • Parse the response to identify the folder locations. Many APIs return data in JSON format, so you can use jq to extract specific fields like the folder path:

      bash
      Copy code
      curl -X GET "https://yourserver.com/api/packages" -H "Authorization: Bearer <Your_Token>" | jq '.packages[] | {name: .name, location: .folder}'

    This command fetches all packages and extracts their name and folder location.

  4. Automate Replication:

    • With this information, you can script a replication process that takes the folder paths from the query and replicates them to other environments as needed.

If the system doesn’t provide an API for querying package locations, you may have to check for documentation on other commands (e.g., via a CLI if available) that could list installed packages and their locations. If no direct API is available, another option is to automate an SSH script that lists directories within the base folder where packages are typically installed.

 

Source: https://talenttitan.com/candidates/interview-preparation/