Attachments

Temporarily unavailable in User.com 2.0

File types

You can send any file type you want. It is packed to download it from our servers. It won't be executed on any server (to prevent hijacking of websites).

POST

/channels/:id/upload/

Attributes
Type
Description
id
integer
Unique ID of a channel
Data
file
file
Path to your file
curl -X POST -H "Authorization: Token <your_64_char_api_key>" -F "file=@/path/to/file_upload.png" "https://app.userengage.com/api/public/channels/:id/upload/"
var form = new FormData();
form.append("file", {"0":{}});

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://app.userengage.com/api/public/channels/:id/upload/",
  "method": "POST",
  "headers": {
    "authorization": "Token <your_64_char_api_key>"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
var data = new FormData();
data.append("file", {"0":{}});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://app.userengage.com/api/public/channels/:id/upload/");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");

xhr.send(data);
var fs = require("fs");
var request = require("request");

var options = { method: 'POST',
  url: 'https://app.userengage.com/api/public/channels/:id/upload/',
  headers:
    { authorization: 'Token <your_64_char_api_key>',
      formData: {
        file:
          {
            value: 'fs.createReadStream("[object Object]")',
            options: { filename: { '0': {} }, contentType: null }
          }
        }
    };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
<?php

$request = new HttpRequest();
$request->setUrl('https://app.userengage.com/api/public/channels/:id/upload/');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'authorization' => 'Token <your_64_char_api_key>',
  'content-type' => 'multipart/form-data'
));

$request->setBody('Content-Disposition: form-data; name="file"; filename="[object Object]"
Content-Type: false');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
import requests

url = "https://app.userengage.com/api/public/channels/:id/upload/"

payload = "Content-Disposition: form-data; name=\"file\"; filename=\"[object Object]\"\r\nContent-Type: false"
headers = {
    'content-type': "multipart/form-data",
    'authorization': "Token <your_64_char_api_key>"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
import http.client

conn = http.client.HTTPSConnection("app.userengage.com")

payload = "Content-Disposition: form-data; name=\"file\"; filename=\"[object Object]\"\r\nContent-Type: false"

headers = {
    'content-type': "multipart/form-data",
    'authorization': "Token <your_64_char_api_key>"
    }

conn.request("POST", "/api/public/channels/:id/upload/", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))