Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. console.log(files)
  2. async.eachOfSeries(files, function(file, callback){
  3. var idname = file.slice(0, -4);
  4.  
  5. var options = {
  6. uri: 'http://(*api url*)',
  7. method: 'POST',
  8. headers: {
  9. 'Content-Type': 'application/json',
  10. 'apikey': '*apikey*',
  11. 'userid': '400',
  12. },
  13. json: [{
  14.  
  15. "gender": "female",
  16. "uid": idname,
  17. "images":[{
  18. "imageUrl": "*imageurl*"+file,
  19. }]
  20.  
  21. }]
  22. }
  23.  
  24. request(options, function (error, response, body) {
  25. if(error) callback(error);
  26.  
  27. if (!error && response.statusCode == 200) {
  28. console.log(body.id);
  29. }
  30. callback(null, "ok")
  31. });
  32. }, function(error){
  33. if(error) console.log(error)
  34. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement