Oktopost
Publishing

Upload

The following endpoint can be used to read and create media upload requests.

Get Upload

Get a single upload by ID.

Example Request

curl -i https://api.oktopost.com/v2/upload/0up000000000001

Example Result

{
    "Result": true,
    "Upload": {
        "Id": "0up000000000001",
        "Created": "2020-06-25 06:49:51",
        "Modified": "2020-06-25 06:51:20",
        "CreatedBy": "00A000000000001",
        "Status": "complete",
        "Name": "MyVideo.mp4",
        "MimeType": "video/mp4",
        "TotalSize": 17839845,
        "Downloaded": 17839845,
        "Source": "https://example_download...",
        "LastError": null,
        "Attempts": 0,
        "MediaId": "026000000000001"
    }
}

List Upload

List account uploads.

Example Request

curl -i https://api.oktopost.com/v2/upload

Example Result

{
    "Result":true,
    "Items":[
        {
            "Id": "0up000000000001",
            "Created": "2020-06-25 06:49:51",
            "Modified": "2020-06-25 06:51:20",
            "CreatedBy": "00A000000000001",
            "Status": "complete",
            "Name": "MyVideo.mp4",
            "MimeType": "video/mp4",
            "TotalSize": 17839845,
            "Downloaded": 17839845,
            "Source": "https://example_download...",
            "LastError": null,
            "Attempts": 0,
            "MediaId": "026000000000001"
        },
        ...
    ],
    "Total":696
}

Parameters

ParamDefaultDescription
status-Status of the upload, one of pending, failed, complete.
source-Url-encoded upload source url
_page0The current page
_count20The number of results per page

Create Upload

Example Request

curl -i https://api.oktopost.com/v2/upload -X POST \
    -d source="https://example_download..." \
    -d mimeType="video/mp4" \
    -d name="MyFile.mp4"

Parameters

Fields

FieldDescription
sourceA public URL to your file. It must support HEAD and GET requests with a Range header for chunked downloads.
nameOptional. The file name.
mimeTypeOptional. The mime type of the uploaded file. Supported types: video/mp4, image/gif, image/png, image/jpg, image/jpeg

The maximum allowed file size for uploads is 8 GiB, with a 32 GiB upload limit within a sliding 24-hour window.

This endpoint only validates file size and mime type and does not check your file against the social network's specifications.

Example Result

{
    "Result": true,
    "Upload": {
        "Id": "0up000000000001",
        "Created": "2020-06-25 06:49:51",
        "Modified": "2020-06-25 06:51:20",
        "CreatedBy": "00A000000000001",
        "Status": "complete",
        "Name": "MyVideo.mp4",
        "MimeType": "video/mp4",7
        "TotalSize": 17839845,
        "Downloaded": 17839845,
        "Source": "https://example_download...",
        "LastError": null,
        "Attempts": 0,
        "MediaId": "026000000000001"
    }
}

If the mimeType or name fields are not sent and can not be determined from the source, the request will fail.

Chunked Uploads

If your file weighs more than 10 MiB, Oktopost will try to download it in chunks. If one of the chunked requests fails, the system will retry to download it up to 5 times before failing the entire request.

To check if your request has been processed, you can use the Get Upload endpoint above. While the upload is in progress, the Status field will be set to pending, and the MediaId will be set to null.

{
    "Result": true,
    "Upload": {
        "Id": "0up000000000001",
        "Created": "2020-06-25 06:49:51",
        "Modified": "2020-06-25 06:51:20",
        "CreatedBy": "00A000000000001",
        "Status": "pending",
        "Name": "MyVideo.mp4",
        "MimeType": "video/mp4",
        "TotalSize": 17839845,
        "Downloaded": 10000000,
        "Source": "https://example_download...",
        "LastError": null,
        "Attempts": 0,
        "MediaId": null
    }
}

Once the upload is complete, the Status field will be set to complete, and you'll be able to use the MediaId to reference the Media endpoint.

{
    "Result": true,
    "Upload": {
        "Id": "0up000000000001",
        "Created": "2020-06-25 06:49:51",
        "Modified": "2020-06-25 06:51:20",
        "CreatedBy": "00A000000000001",
        "Status": "complete",
        "Name": "MyVideo.mp4",
        "MimeType": "video/mp4",7
        "TotalSize": 17839845,
        "Downloaded": 17839845,
        "Source": "https://example_download...",
        "LastError": null,
        "Attempts": 0,
        "MediaId": "026000000000001"
    }
}

If the upload fails, the Status field will be set to failed and the LastError field will contain the error message.

{
    "Result": true,
    "Upload": {
        "Id": "0up000000000001",
        "Created": "2020-06-25 06:49:51",
        "Modified": "2020-06-25 06:51:20",
        "CreatedBy": "00A000000000001",
        "Status": "failed",
        "Name": "MyVideo.mp4",
        "MimeType": "video/mp4",
        "TotalSize": 17839845,
        "Downloaded": 5000000,
        "Source": "https://example_download...",
        "LastError": "Could not download file, error 500",
        "Attempts": 5,
        "MediaId": null
    }
}

Validate Video Upload

Example Request

curl -i  https://api.oktopost.com/v2/video-validate/026000000000000

Example Result

{
	"Result": true,
	"Validations": {
		"Facebook": {
			"isValid": true,
			"errors": []
		},
		"LinkedIn": {
			"isValid": true,
			"errors": []
		},
		"Twitter": {
			"isValid": true,
			"errors": []
		},
		"Instagram": {
			"isValid": true,
			"errors": []
		},
		"Youtube": {
			"isValid": true,
			"errors": []
		}
	}
}