Searching the Help
To search for information in the Help, type a word or phrase in the Search box. When you enter a group of words, OR is inferred. You can use Boolean operators to refine your search.
Results returned are case insensitive. However, results ranking takes case into account and assigns higher scores to case matches. Therefore, a search for "cats" followed by a search for "Cats" would return the same number of Help topics, but the order in which the topics are listed would be different.
Search for | Example | Results |
---|---|---|
A single word | cat
|
Topics that contain the word "cat". You will also find its grammatical variations, such as "cats". |
A phrase. You can specify that the search results contain a specific phrase. |
"cat food" (quotation marks) |
Topics that contain the literal phrase "cat food" and all its grammatical variations. Without the quotation marks, the query is equivalent to specifying an OR operator, which finds topics with one of the individual words instead of the phrase. |
Search for | Operator | Example |
---|---|---|
Two or more words in the same topic |
|
|
Either word in a topic |
|
|
Topics that do not contain a specific word or phrase |
|
|
Topics that contain one string and do not contain another | ^ (caret) |
cat ^ mouse
|
A combination of search types | ( ) parentheses |
|
- Artifact API
- Artifact types
- Create an artifact
- View an artifact
- Update an artifact
- Delete an artifact
- Retrieve a predefined view for an artifact
- Retrieve resolved properties for an artifact
- List active groups associated with an organization
- Add groups to an organization
- Update group display name, distinguished name
- Delete or disassociate group from an organization
- List resource providers
- Add document to service offering
- Delete document from service offering
- Update document in service offering
- Publish service offerings to catalog
- Unpublish service offerings from catalog
- Retrieve artifact state and status
- Artifact views
Add document to service offering
Details
URI | /artifact/<service_offering_id>/document
|
---|---|
Method | POST |
Parameters |
|
Returns | 200 - Ok 401 - Not authorized 404 - Object not found 500 - Server exception |
Example
The following URL was sent with headers:
- Content-type: multipart/form-data
- Content-Disposition: form-data; name="file"
- Content-Type: application/octet-stream
https://<host>:<port>/csa/rest/artifact/90cef5de3c63429f013c68b8cdda0bad/document?userIdentifier=90cef5de3c63429f013c642c7fc708ab
To better demonstrate how to use this REST API URI, see the sample python script that attaches a text file to a service offering. The script is created based on HTML documentation and you can find more information on HTML form 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 90cec0773c83a11a013c871e4c1a0503 using an admin user ID
90d96588360da0c701360da0f1d5f483
post-doc.py 90cec0773c83a11a013c871e4c1a0503 doc.txt 90d96588360da0c701360da0f1d5f483
Tested with: ActivePython 3.2.2.3
"""
from xml.dom.minidom import parse, parseString
from http.client import HTTPSConnection
from base64 import b64encode
import mimetypes
import sys
def get_content_type(filename):
return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
def get_file_contents(filename):
CRLF = '\r\n'
f = open(filename, 'r')
return CRLF.join(f.readlines())
def encode_multipart_formdata(filename):
BOUNDARY = '----------CSA_r0ck$_$'
CRLF = '\r\n'
L = []
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="file"; filename="%s"' % filename)
L.append('Content-Type: %s' % get_content_type(filename))
L.append('')
L.append(get_file_contents(filename))
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
def addDocumentToOffering(offeringId, documentName, userId):
conn = HTTPSConnection("localhost:8444")
userAndPass = b64encode(b"csaTransportUser:csaTransportUser").decode("ascii")
post_url = "/csa/rest/artifact/" + offeringId + "/document?userIdentifier="+userId
content_type, body = encode_multipart_formdata(documentName)
content_length = str(len(body))
headers = {'Authorization' : 'Basic %s' % userAndPass,
'Content-Type' :'%s' % content_type, 'content-length' : str(len(body)), 'Accept' : 'application/xml'}
conn.request('POST', post_url, body, headers=headers)
res = conn.getresponse()
data = res.read()
print(data)
def main(offeringId, documentName, userId):
addDocumentToOffering(offeringId, documentName, userId)
if __name__ == "__main__":
offeringId = sys.argv[1]
documentName = sys.argv[2]
userId = sys.argv[3]
main(offeringId, documentName, userId)
We welcome your comments!
To open the configured email client on this computer, open an email window.
Otherwise, copy the information below to a web mail client, and send this email to clouddocs@hpe.com.
Help Topic ID:
Product:
Topic Title:
Feedback: