Kodmyran Commerce Developer
  • API Documentation
    • API Overview
    • Integration API
    • Headless API
    • Report API
    • Service API
    • Entity API
    • Media API
  • Frontend
  • Platform
    • A/B Testing
  • Tools
    • Swagger UI
  • kodmyran.se

Media API

Download as PDF

  • Introduction
  • Security
  • Response

Introduction

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.

  • Use GET to return information about the file/directory such as its type, size etc
  • Use PUT to upload a new file or replace an existing one
  • Use DELETE to remove a file

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.

Currently only files that are images can be uploaded. A check will be made on the contents of the file.
The system will verify that the file name extension matches the actual file type, if not an upload will be denied.

Security

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.

Response

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)

Copyright (C) 2003-2020 Kodmyran AB
All rights reserved.