Skip to content

Instantly share code, notes, and snippets.

@m4tlch
Created September 28, 2017 07:39
Show Gist options
  • Save m4tlch/6ea93f1a1ae886394005d8bb009e76aa to your computer and use it in GitHub Desktop.
Save m4tlch/6ea93f1a1ae886394005d8bb009e76aa to your computer and use it in GitHub Desktop.
Auth token from amo
(function(m, id, cb){
$.ajax({
method: "GET",
headers: {"X-Auth-Token": m.auth_token},
url: m.server_base + "/ui/api/v1.1/ajax/mail/attach/" + id,
success: cb
});
})(
// Объект авторизации AmoMail
AMOCRM.constant('amomail'),
// ID аттача из data-id
"98723861",
// Callback-функция для работы с полученным URL на скачивание аттача
function (data) {
console.log(data);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment