REST API - add
com.vmware.content.library.item.updatesession.file
add
POST /com/vmware/content/library/item/updatesession/file/id:{update_session_id}?~action=add |
POST /com/vmware/content/library/item/updatesession/file?~action=add |
Requests file content to be changed (either created, or updated). Depending on the source type of the file, this operation will either return an upload endpoint where the client can push the content, or the server will pull from the provided source endpoint. If a file with the same name already exists in this session, this operation will be used to update the content of the existing file.
When importing a file directly from storage, where the source endpoint is a file or datastore URI, you will need to have the ContentLibrary.ReadStorage privilege on the library item. If the file is located in the same directory as the library storage backing folder, the server will move the file instead of copying it, thereby allowing instantaneous import of files for efficient backup and restore scenarios. In all other cases, a copy is performed rather than a move.
- Request:
-
- Representations:
{
"file_spec": {
"checksum_info": {
"algorithm": "SH_a1",
"checksum": "string"
},
"name": "string",
"size": 10,
"source_endpoint": {
"ssl_certificate_thumbprint": "string",
"uri": "http://myurl.com"
},
"source_type": "NONE"
},
"update_session_id": "obj-103"
}<?xml version="1.0" ?>
<ns0:Add-Input xmlns:ns0="http://vmware.com/content/library/item/updatesession/file" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<update_session_id>obj-103</update_session_id>
<file_spec>
<source_endpoint>
<ssl_certificate_thumbprint>string</ssl_certificate_thumbprint>
<uri>http://myurl.com</uri>
</source_endpoint>
<name>string</name>
<source_type>NONE</source_type>
<checksum_info>
<checksum>string</checksum>
<algorithm>SH_a1</algorithm>
</checksum_info>
<size>10</size>
</file_spec>
</ns0:Add-Input>POST /com/vmware/content/library/item/updatesession/file?~action=add
&update_session_id=obj-103
&file_spec.source_endpoint.ssl_certificate_thumbprint=string
&file_spec.source_endpoint.uri=http%3A%2F%2Fmyurl.com
&file_spec.name=string
&file_spec.source_type=NONE
&file_spec.checksum_info.checksum=string
&file_spec.checksum_info.algorithm=SH_a1
&file_spec.size=10- Parameters:
Name Type Required Description update_session_id *
ID Yes Identifier of the update session to be modified. Id of type com.vmware.content.library.item.UpdateSession. file_spec *
add_spec Yes Specification for the file that needs to be added or updated. This includes whether the client wants to push the content or have the server pull it. - Response:
-
- Representations:
{
"value": {
"bytes_transferred": 10,
"checksum_info": {
"algorithm": "SH_a1",
"checksum": "string"
},
"error_message": {
"args": [
"string",
"string"
],
"default_message": "string",
"id": "string"
},
"name": "string",
"size": 10,
"source_endpoint": {
"ssl_certificate_thumbprint": "string",
"uri": "http://myurl.com"
},
"source_type": "NONE",
"status": "WAITING_FOR_TRANSFER",
"upload_endpoint": {
"ssl_certificate_thumbprint": "string",
"uri": "http://myurl.com"
}
}
}<?xml version="1.0" ?>
<ns0:Add-Result xmlns:ns0="http://vmware.com/content/library/item/updatesession/file" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<value>
<source_endpoint>
<ssl_certificate_thumbprint>string</ssl_certificate_thumbprint>
<uri>http://myurl.com</uri>
</source_endpoint>
<status>WAITING_FOR_TRANSFER</status>
<error_message>
<default_message>string</default_message>
<id>string</id>
<args-array>
<array-item>string</array-item>
<array-item>string</array-item>
</args-array>
</error_message>
<name>string</name>
<upload_endpoint>
<ssl_certificate_thumbprint>string</ssl_certificate_thumbprint>
<uri>http://myurl.com</uri>
</upload_endpoint>
<source_type>NONE</source_type>
<bytes_transferred>10</bytes_transferred>
<checksum_info>
<checksum>string</checksum>
<algorithm>SH_a1</algorithm>
</checksum_info>
<size>10</size>
</value>
</ns0:Add-Result>- Parameters:
Name Type Required Description result info Yes An com.vmware.content.library.item.updatesession.file.info structure containing upload links as well as server side state tracking the transfer of the file. - Errors:
-
Type Description HTTP Status Code invalid_argument if the file_spec
is invalid.400 not_found if the update session doesn't exist. 404 unauthorized if the caller doesn't have ContentLibrary.ReadStorage privilege on the library item of the update session and source type PULL is requested for a file or datastore source endpoint (that is, not HTTP or HTTPs based endpoint). 403
Copyright © 2014. All Rights Reserved.