The media API is used to upload, delete or retrieve file/directory data for images in the Kodmyran Commerce upload area. It is identical to using the SFTP interface or the GUI upload dialogue.
API Endpoint:
https://testaccount.shop4sale.se/admin/api/media
Append the filename to the end-point above and make a GET, PUT or DELETE request.
Directories are created automatically by the API and need not be created before upload. Unlike the SFTP interface the system will refuse to remove files that are in use by a product.
In order to be able to use this API you must provide an API key as described in the overview, the authenticated user must also possess the Remote call: Read (for GET requests) or Remote call: Write (for PUT and DELETE requests) permissions.
The system will respond with a 200 OK and standard response body for a successful DELETE or PUT operation. For a successful GET the system will respond with a JSON structure with information about the file/directory.
Successful response for DELETE or PUT:
{
callStatus: "OK",
message: "No error"
}
Successful response for a GET:
{
callStatus: "OK",
message: "No error",
statistics: {
size: 12345678,
atime: 12345678,
mtime: 12345678,
ctime: 12345678,
type: "file"
}
}
Field | Use |
---|---|
Size | The size of the file in bytes |
Atime | The last timestamp when the file was accessed |
Mtime | The last timestamp when the file was modified |
Ctime | The timestamp when the file was created |
Type | Either dir or file |
The timestamps are given as UNIX timestamps (seconds since epoch Jan 1st 1970)