Guest User

Untitled

a guest
Dec 15th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. var request = require('request');
  2. function get_trustyou(trust_you_id, callback){
  3. var options = {
  4. url: 'https://xxxxxx/api/json/v2/types/consistency-groups',
  5. rejectUnauthorized: false,
  6. method: 'GET',
  7. type: 'application/json',
  8.  
  9. auth:{
  10. user: 'xxxxx',
  11. pass: 'xxx'
  12. }
  13. };
  14. var res = '';
  15. request(options, function ( error, resp, body ) {
  16. if ( !error && resp.statusCode == 200){
  17. res = body;
  18. }
  19. if (error) {
  20. console.log("this is error" + error);
  21. }
  22. callback(res);
  23. });
  24. }
  25. get_trustyou("674fa44c-1fbd-4275-aa72-a20f262372cd", function(resp){
  26. console.log("Here is the result" + resp);
  27. });
  28.  
  29. var request = require('request');
  30. function get_trustyou(trust_you_id, callback){
  31. var options = {
  32. body: postData,
  33. url: 'https://xxxx/api/json/v2/types/consistency-groups',
  34. rejectUnauthorized: false,
  35. method: 'POST',
  36. type: 'application/json',
  37. auth:{
  38. user: 'xxxx',
  39. pass: 'xxxxx'
  40. },
  41. form: {
  42. 'consistency-group-name': 'TEST-CG'
  43. }
  44.  
  45. };
  46. request(options, function ( error, resp, body ) {
  47. if ( !error && resp.statusCode == 200){
  48. res = body;
  49. }
  50. if (error) {
  51. console.log("this is error" + error);
  52. }
  53. callback(res);
  54. });
  55. }
  56. get_trustyou("674fa44c-1fbd-4275-aa72-a20f262372cd", function(resp){
  57. console.log("this is the responce" + resp);
  58. });
Add Comment
Please, Sign In to add comment