com.vmware.content.library.item.updatesession.file

The file service provides operations for accessing files within an update session.

After an update session is created against a library item, the file service can be used to make changes to the underlying library item metadata as well as the content of the files. The following changes can be made:

  • deleting an existing file within the library item. This deletes both the metadata and the content.
  • updating an existing file with new content.
  • adding a new file to the library item.

The above changes are not applied or visible until the session is completed. See com.vmware.content.library.item.update_session.

validate

POST /com/vmware/content/library/item/updatesession/file/id:{update_session_id}?~action=validate
POST /com/vmware/content/library/item/updatesession/file?~action=validate

Validates the files in the update session with the referenced identifier and ensures all necessary files are received. In the case where a file is missing, this operation will return its name in the com.vmware.content.library.item.updatesession.file.validation_result.missing_files set. The user can add the missing files and try re-validating. For other type of errors, com.vmware.content.library.item.updatesession.file.validation_result.invalid_files will contain the list of invalid files.
Request:
Representations:
{
    "update_session_id""obj-103"
}
<?xml version="1.0" ?>
<ns0:Validate-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>
</ns0:Validate-Input>
POST /com/vmware/content/library/item/updatesession/file?~action=validate
&update_session_id=obj-103

Parameters:
Name Type Required Description
update_session_id
 *
ID Yes Identifier of the update session to validate. Id of type com.vmware.content.library.item.UpdateSession.

Response:
Representations:
{
    "value"{
        "has_errors"true,
        "invalid_files"[
            {
                "error_message"{
                    "args"[
                        "string",
                        "string"
                    ],
                    "default_message""string",
                    "id""string"
                },
                "name""string"
            },
            {
                "error_message"{
                    "args"[
                        "string",
                        "string"
                    ],
                    "default_message""string",
                    "id""string"
                },
                "name""string"
            }
        ],
        "missing_files"[
            "string",
            "string"
        ]
    }
}
<?xml version="1.0" ?>
<ns0:Validate-Result xmlns:ns0="http://vmware.com/content/library/item/updatesession/file" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <value>
    <has_errors>true</has_errors>
    <missing_files-array>
      <array-item>string</array-item>
      <array-item>string</array-item>
    </missing_files-array>
    <invalid_files-array>
      <array-item>
        <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>
      </array-item>
      <array-item>
        <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>
      </array-item>
    </invalid_files-array>
  </value>
</ns0:Validate-Result>

Parameters:
Name Type Required Description
result validation_result Yes A validation result containing missing files or invalid files and the reason why they are invalid.

Errors:
Type Description HTTP Status Code
not_found if no update session with the given identifier exists. 404
not_allowed_in_current_state if the update session is not in the ACTIVE state, or if some of the files that will be uploaded by the client aren't received correctly. 400

Copyright © 2014. All Rights Reserved.