REST package references


A package reference represents a link to the content (file, directory, archive and so on) that you use for the deployment process.To deploy a package, you must create at least one reference in the package. You cannot deploy a package without a reference.

Note

The include_except and alone filters are available in only 5.0.03.004 and later versions of RPM. Use these filters to limit the data in API response and hence, reduce the API response time.

POST /v1/package_references

Creates a new package reference.

Required attributes

  • name — String name of the package reference
  • server_id — String ID of the associated server
  • package_id — String ID of the parent package
  • uri — String of the URI to the reference

    Note

    You must indicate all four mandatory fields to create a reference.

Filters

  • property — Special property setting accessor that takes key value pairs and attaches them to the reference

    Note

    The property value must already exist and must be assigned to the reference.

  • properties_with_values — Hash of key value pairs such as:

     { 'server_url' => 'localhost', 'user_name' => 'admin' }
  • include_except—Comma-separated strings of the top-level associated items to exclude from the response. You can remove only top-level associated items from the response and these associated items should be a collection (zero to many) of other objects (not a simple property—string, numeric, boolean, and so on). For example, you can remove components from an application but you cannot remove route gates (it is not a top-level associated item) or app_version (it is a simple property). If you provide an incorrect associated item name (for example, the associated item does not exist, is not at the top level, or is a property), the name is ignored. See the table below for the items and their associated items.
  • alone—Boolean value to return only the item or the associated items as well along with the item. If set to false (default), item and associated item details are returned; if set to true, only item details are returned. See the table below for the items and their associated items. See the table below for the items and their associated items.

Item

Associated items

package_references

property_values

Common attributes

  • format — Ensure to include an accept header or add .xml or .json to the last path element
  • token — Your API Token for authentication

Errors caused

  • ERROR 403 Forbidden — Occurs when the token is invalid.
  • ERROR 422 Unprocessable entity — Occurs when validation fails; objects and errors are returned.

Examples

To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:

curl -i -H "accept: text/xml"  -H "Content-type: text/xml" -X POST -d "<reference><name>Reference</name><server_id>2</server_id><package_id>123</package_id><uri>/path/to/file</uri></reference>" http://[rails_host]/v1/references?token=[...your token ...]
curl -i -H "accept: application/json" -H "Content-type: application/json" -X POST -d '{ "reference": { "name" : "Reference", "server_id" : "123", "package_id" : "1234", "uri" : "/path/to/file" }}' http://[rails_host]/v1/references/?token=[api_token]

Filter example:

curl -i -H "accept: application/json" -H "Content-type: application/json" -X POST -d '{ "reference": { "name" : "Rest Package Reference 1", "server_id" : "1", "package_id" : "1", "uri" : "/path/to/file"}, "filters": {"include_except" : "property_values"}}' https://[rails_host]/v1/references/?token=[api_token]

PUT /v1/package_references/[id]

Updates an existing package reference with values from a posted document.

Required attributes

  • name — String name of the package reference
  • server_id — String ID of the associated server
  • package_id — String ID of the parent package
  • uri — String of the URI to the reference

    Note

    You must indicate all four mandatory fields to create a reference

Filters

  • property — Special property setting accessor that takes key value pairs and attaches them to the reference

    Note

    The property value must already exist and must be assigned to the reference.

  • properties_with_values — Hash of key value pairs such as:

     { 'server_url' => 'localhost', 'user_name' => 'admin' }
  • include_except—Comma-separated strings of the top-level associated items to exclude from the response. You can remove only top-level associated items from the response and these associated items should be a collection (zero to many) of other objects (not a simple property—string, numeric, boolean, and so on). For example, you can remove components from an application but you cannot remove route gates (it is not a top-level associated item) or app_version (it is a simple property). If you provide an incorrect associated item name (for example, the associated item does not exist, is not at the top level, or is a property), the name is ignored. See the table below for the items and their associated items.
  • alone—Boolean value to return only the item or the associated items as well along with the item. If set to false (default), item and associated item details are returned; if set to true, only item details are returned. See the table below for the items and their associated items. See the table below for the items and their associated items.

Item

Associated items

package_references

property_values

Common attributes

  • format — Ensure to include an accept header or add .xml or .json to the last path element
  • token — Your API Token for authentication

Errors caused

  • ERROR 403 Forbidden — Occurs when the token is invalid.
  • ERROR 422 Unprocessable entity — Occurs when validation fails; objects and errors are returned.

Examples

To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:

curl -i -H "accept: text/xml"  -H "Content-type: text/xml" -X PUT -d "<reference><name>Reference</name><server_id>2</server_id><package_id>123</package_id><uri>/path/to/file</uri></reference>" http://[rails_host]/v1/references/[reference_id]?token=[...your token ...]
curl -i -H "accept: application/json" -H "Content-type: application/json" -X PUT -d '{ "reference": { "name" : "Reference", "server_id" : "123", "package_id" : "1234", "uri" : "/path/to/file" }}' http://[rails_host]/v1/references/[reference_id]?token=[api_token]

Filter example:

curl -i -H "accept: application/json" -H "Content-type: application/json" -X PUT -d '{ "reference": { "name" : "Renamed Package Reference 1"}, "filters": { "include_except":"property_values" }}' https://[rails_host]/v1/references/[id]?token=[api_token]

DELETE /v1/package_references/[id]

Deletes a package reference by deactivating it.

Common attributes

  • id — Numerical unique ID for the record
  • format — Ensure to include an accept header or add .xml or .json to the last path element
  • token — Your API Token for authentication

Errors caused

  • ERROR 403 Forbidden — Occurs when the token is invalid.
  • ERROR 404 Not found — Occurs when no records are found.

Examples

To test this method, insert this URL or your valid API key and application host into a browser or HTTP client like wget or curl. For example:

curl -i -H "accept: text/xml" -X DELETE http://[rails_host]/v1/references/[reference_id]?token=[api_token]
curl -i -H "accept: application/json" -X DELETE http://[rails_host]/v1/references/[reference_id]?token=[api_token]

 

Related topics

REST packages

REST package instances

 

 

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*