Skip to main content

documents

Creates, updates, deletes, gets or lists a documents resource.

Overview​

Namedocuments
TypeResource
Idovh.me.documents

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Document id
namestringDocument name
creation_datestring (date-time)Document creation (wire: creationDate)
expiration_datestring (date-time)Document expiration (wire: expirationDate)
get_urlstringURL used to get document (wire: getUrl)
put_urlstringURL used to put document (wire: putUrl)
sizeintegerDocument size (in bytes)
tagsarrayDocument tags
validation_datestring (date-time)Document validation (wire: validationDate)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectidGet this object properties
listselectx_pagination_modeList of documents added in your account
createinsertnameCreate new document
updateupdateidAlter this object properties
deletedeleteidDelete a document
corsexecoriginAdd CORS support on your container

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
idstring (uuid)Document id
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Get this object properties

SELECT
id,
name,
creation_date,
expiration_date,
get_url,
put_url,
size,
tags,
validation_date
FROM ovh.me.documents
WHERE id = '{{ id }}' -- required
;

INSERT examples​

Create new document

INSERT INTO ovh.me.documents (
name,
tags
)
SELECT
'{{ name }}' /* required */,
'{{ tags }}'
RETURNING
id,
name,
creation_date,
expiration_date,
get_url,
put_url,
size,
tags,
validation_date
;

UPDATE examples​

Alter this object properties

UPDATE ovh.me.documents
SET
expiration_date = '{{ expiration_date }}'
WHERE
id = '{{ id }}' --required;

DELETE examples​

Delete a document

DELETE FROM ovh.me.documents
WHERE id = '{{ id }}' --required
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Add CORS support on your container

EXEC ovh.me.documents.cors
@@json=
'{
"origin": "{{ origin }}"
}'
;