younifyd
Menu

Create A File

Create a File

POST/v2/files

Use it in a workflow

  1. Add a step and choose the Elastic Path connector.
  2. Pick the Create A File action (under Files).
  3. Fill in the fields below, then reference the result from later steps as {{createAFile.response.data}}.

Request

Request body

Enter the body as JSON in the step's Body field.

filestring (binary)

Indicates the file you want to upload.

file_locationstring

Use this parameter to reference a file stored at a specific location. This must be the URL that points to an image file.

json
{
  "file": "UploadFile",
  "file_location": "@/path/to/file.jpg"
}

Response

Returns 201 with an object. Read it in later steps with {{createAFile.response.data.<field>}}.

dataobject
idstring (uuid)
typestring

The type represents the object being returned.

file_namestring

The name of the file.

mime_typestring

The mime type of the file.

file_sizeinteger

The size of the file. Required when uploading files.

publicboolean

DEPRECATED Whether the file public or not. Required when uploading files.

metaobject2 fields
linksobject1 fields

Links are used to allow you to move between requests.

linkobject1 fields

The publicly available URL for this file.

json
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "type": "file",
    "file_name": "file_name.jpg",
    "mime_type": "image/jpeg",
    "file_size": 36000,
    "public": true,
    "meta": {
      "timestamps": {
        "created_at": "2023-10-11T13:02:25.293Z"
      },
      "dimensions": {
        "width": 1800,
        "height": 1000
      }
    },
    "links": {
      "self": "https://https://euwest.api.elasticpath.com//v2/files/ddc28c74-a7df-46be-b262-8fa69a6e7d52"
    },
    "link": {
      "href": "https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/f8cf26b3-6d38-4275-937a-624a83994702.png"
    }
  }
}

Need more? See the Elastic Path guide for connection setup and behaviour shared by every action.