Get contents of file or directory
Changed onA client can optionally specify a type and/or format argument via URL parameter. When given, the Contents service shall return a model in the requested type and/or format. If the request cannot be satisfied, e.g. type=text is requested, but the file is binary, then the request shall fail with 400 and have a JSON response containing a 'reason' field, with the value 'bad format' or 'bad type', depending on what was requested.
Request
- Base URL/ (relative, and the document was published on a file host, not at the API’s origin)
- Authnone declared
Path parameters
file path
Query parameters
File type ('file', 'directory')
How file content should be returned ('text', 'base64')
Return content (0 for no content, 1 for return content)
May return hash hexdigest string of content and the hash algorithm (0 for no hash - default, 1 for return hash). It may be ignored by the content manager.
Response
Contents of file or directory
A contents object. The content and format keys may be null if content is not contained. The hash maybe null if hash is not required. If type is 'file', then the mimetype will be null.
Name of file or directory, equivalent to the last part of the path
Full path for file or directory
Type of content
indicates whether the requester has permission to edit the file
Creation timestamp
Last modified timestamp
The size of the file or notebook in bytes. If no size is provided, defaults to null.
The mimetype of a file. If content is not null, and type is 'file', this will contain the mimetype of the file, otherwise this will be null.
The content, if requested (otherwise null). Will be an array if type is 'directory'
Format of content (one of null, 'text', 'base64', 'json')
[optional] The hexdigest hash string of content, if requested (otherwise null). It cannot be null if hash_algorithm is defined.
[optional] The algorithm used to produce the hash, if requested (otherwise null). It cannot be null if hash is defined.
Changes
- breaking
added the new path request parameter
path - info
added the media type
application/jsonfor the response with the status - info
added the media type
application/jsonfor the response with the status
- breaking