CLI Reference Guide

...
</ResourceProviderList>
Add document to service offering
Details
URI
/artifact/<service_offering_id>/document
Method
POST
Parameters
userIdentifier=<user_id>
Required; the user ID you want to use as credentials for this API call. See "Get
userIdentifier" on page 88 for the steps required to get the userIdentifier value.
Returns
200 - Ok
401 - Not authorized
404 - Object not found
500 - Server exception
Example
The following URL was sent with headers:
l Content-type: multipart/form-data
l Content-Disposition: form-data; name="file"
l Content-Type: application/octet-stream
https://<host>:<port>/csa/rest/artifact/90cef5de3c63429f013c68b8cdda0bad/documen
t?userIdentifier=90cef5de3c63429f013c642c7fc708ab
To better demonstrate how to use this REST API URI, the following a python script attaches a text
file to a service offering. The script was created based on HTML documentation. You can find
information on html form content types at: http://www.w3.org/TR/html401/interact/forms.html#h-
17.13.4.2.
""" Sample python script that attaches a text file in the current directory to
an ACTIVE CSA service offering on a local host, with default credentials.
Script usage:
<scrip-name.py> <service offering uuid> <filename> <admin uuid>
The following example attaches file doc.txt to the service offering with id 90ce
c0773c83a11a013c871e4c1a0503 using an admin user ID
90d96588360da0c701360da0f1d5f483
post-doc.py 90cec0773c83a11a013c871e4c1a0503 doc.txt 90d96588360da0c701360da0f1d
5f483
Tested with: ActivePython 3.2.2.3
"""
from xml.dom.minidom import parse, parseString
from http.client import HTTPSConnection
HP Cloud Service Automation (4.00) Page 28 of 141
APIReference
Contents