Archive:Build Service Curl
This article about the Open Build Service is obsolete! You can find up to date information on https://build.opensuse.org/apidocs-new/ |
How to use curl for build service development
See osc help api.
Curl is a command line tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, TFTP, DICT, TELNET, LDAP or FILE).
The command is designed to work without user interaction.
It can help testing the openSUSE build service API a lot while development.
Here are the most commonly used commands:
GET request
curl -u username:password -X GET https://$APISERVER/any/path
PUT request
curl -u username:password -X PUT -T /path/to/file/to/put https://$APISERVER/any/path
POST request
curl -u username:password -X POST -T /path/to/file/to/post https://$APISERVER/any/path
DELETE request
curl -u username:password -X DELETE https://$APISERVER/any/path
Examples for openSUSE build service
Please do the following bevore you test the commands below:
export APISERVER=api.opensuse.org export ARCH=i586 export FILENAME=filename export PACKAGE=package export PROJECT=openSUSE:Factory export REPOSITORY=standard export REVISION=r1 export USERNAME=username export PASSWORD=password
Delete a pattern file
curl -u $USERNAME:$PASSWORD -X DELETE https://$APISERVER/source/$PROJECT/_pattern/$FILENAME
Get metadata for a single package
curl -u $USERNAME:$PASSWORD -X GET https://$APISERVER/source/$PROJECT/$PACKAGE/_meta
Get a specific version of a source file
curl -u $USERNAME:$PASSWORD -X GET https://$APISERVER/source/$PROJECT/$PACKAGE/$FILENAME?rev=$REVISION
Get a list of i586 binaries build in a project
curl -u $USERNAME:$PASSWORD -X GET https://$APISERVER/build/$PROJECT/i586/_binarylist
Get a list of published i586 binaries for a project
curl -u $USERNAME:$PASSWORD -X GET https://$APISERVER/published/$PROJECT/openSUSE_10.3/i586
Trigger rebuild for all packages in arch & repo
curl -u $USERNAME:$PASSWORD -X POST -H "Content-Length:0" "https://$APISERVER/build/$PROJECT?cmd=rebuild&arch=$ARCH&repository=$REPOSITORY"
Trigger a wipe of excluded packages
To remove packages with "ExcludeArch:" in specfile finally for an architecture, use
curl -u $USERNAME:$PASSWORD -X POST -H "Content-Length:0" "https://$APISERVER/build/$PROJECT?code=excluded&cmd=wipe"