I have been unable to complete this request, using a few different options, 
none of which are working as I believe implementation is incorrect.  How do 
I get the request through?

my request:

    http{
        host: 'hostsite.com',
        port: 443, 
        data: data.body.prov,
        path: '/api/3/mdm/devices/'+ data.body.id,
        method: 'PUT',
        headers: {'Authorization': 'Bearer xxxxxxxxx'}
    }


It is constructed as such:


AngularJS controller:

$scope.provisionRule = function (rule) {
            var dataToPass = {prov: rule.newProvisions, id: 
$scope.deviceId};

            Rules.provision(dataToPass)
                    .success(function (data) {
                        console.log('provision success')
                        console.log(data);
                    });
}

AngularJS factory:

angular.module('ruleService', [])

    .factory('Rules', function($http) {
        return {
            provision : function(data) {
                console.log('provision: ' + data)
                return $http.put('/api/provisions/', data);
            }
        }
    });

node.js:

module.exports = function (app) {
    //this is not correct syntax but what I am needing to accomplish

    app.put('/api/provisions/', function (data) {

        console.log("provisions prov:" + JSON.stringify(data.body.prov))
        console.log("provisions id:" + JSON.stringify(data.body.id))

    http{
        host: 'hostsite.com',
        port: 443, 
        data: data.body.prov,
        path: '/api/+ data.body.id,
        method: 'PUT',
        headers: {'Authorization': 'Bearer xxxxxxxxx'}
    }
}


using this method below I get: 

   1. Status Code:
   503 Service Unavailable
   

node.js:
module.exports = function (app) {

    var Client = require('node-rest-client').Client;

    app.put('/api/provisions/', function (data) {

        console.log("provisions prov:" + JSON.stringify(data.body.prov))
        console.log("provisions id:" + JSON.stringify(data.body.id))

        var client = new Client();

        var args = {
            path: '/api/'+ data.body.id,
            port: 443,
            headers: {'Authorization': 'Bearer  xxxxxxxxx'},
            data: {'restrictions': data.body.prov}
        };

        console.log('args.data:' + JSON.stringify(args.data))

        client.put("https://hostsite.com";, args, function (data, response) {
            alert(data);
        });

    });
}




I have been provided the host, port, path and headers Bearer.  While the 
above is not the actual provided info, it is a representation of such.  My 
status just hangs in pending.
Any and all help is greatly appreciated as Im banging my head here...  
Thanks!  

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to