How to Change Your P2 Repository Configuration with the REST API
The following steps will help you to change your P2 repository configuration via REST API.
We have also created a cURL command-deployable user plugin, which is available HERE. This will enable you to get and set P2 URLs that are used by P2 repositories, about which more information is available HERE.
Information on how to deploy the P2 user plugin is available HERE.
This user plugin supports two commands:
curl -uadmin:password -X POST "http://localhost:8081/artifactory/api/plugins/execute/getP2Urls?params=repo=repoKey"
Set the value of repoKey to the name of your P2 virtual repository.
{"repo": "p2-virtual","urls": ["http://dl.google.com/eclipse/plugin/3.7","http://download.eclipse.org/releases/luna","http://download.eclipse.org/mylyn/releases/luna","http://download.eclipse.org/eclipse/updates/4.4","local://p2-local/eclipse-repository/eclipse-repository/1.0.0-SNAPSHOT/eclipse-repository-1.0.0-20141213.002711-2.zip!/"]}
Here’s an example of the cURL command:
curl -uadmin:password -T /path/to/jsonFile -X POST "http://localhost:8081/artifactory/api/plugins/execute/modifyP2Urls"