Web api creation to get the unique id of mobile and related information that downloads an app

I want to get the unique id as soon as user downloads an app from his mobile whether that be an android mobile or ios ,Can anybody give me some suggestion I am attaching the snapshots as well.

like wise :

(function (angular) {
var fn = function ($http, $log) {
var r = {
sendDownloadLink: function (phone) {
return $http.post('/downloads/sendlink', { phone: phone });
return r;

angular.module('app').factory('misc', ['$http', '$log', fn]);