Advertisement
Guest User

Untitled

a guest
Jan 29th, 2022
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. First i login to my current instance:
  2.  
  3. const todo = {
  4. username: "admin",
  5. password: "123",
  6. token: "",
  7. rememberMe: "false"
  8. };
  9.  
  10. fetch('/API/Core/Login', {
  11. method: 'POST',
  12. body: JSON.stringify(todo),
  13. headers: {
  14. 'Content-type': 'application/json',
  15. 'accept': 'application/json',
  16. }
  17. })
  18. .then(response => response.json())
  19. .then(json => {
  20. console.log(json);
  21. });
  22.  
  23. i get back my session id... i take it and try to get all instances...
  24.  
  25. const todo = {
  26. SESSIONID: "e31709b9-8676-4a48-80ca-290c9ac7d805"
  27. };
  28.  
  29. fetch('/API/ADSModule/GetInstances', {
  30. method: 'POST',
  31. body: JSON.stringify(todo),
  32. headers: {
  33. 'Content-type': 'application/json',
  34. 'accept': 'application/json',
  35. }
  36. })
  37. .then(response => response.json())
  38. .then(json => {
  39. console.log(json);
  40. });
  41.  
  42. Here i only get the instace where im on... so i only get my main instance id...
  43. so i try it with this:
  44.  
  45. const todo = {
  46. SESSIONID: "e31709b9-8676-4a48-80ca-290c9ac7d805"
  47. };
  48.  
  49. fetch('API/ADSModule/GetLocalInstances', {
  50. method: 'POST',
  51. body: JSON.stringify(todo),
  52. headers: {
  53. 'Content-type': 'application/json',
  54. 'accept': 'application/json',
  55. }
  56. })
  57. .then(response => response.json())
  58. .then(json => {
  59. console.log(json);
  60. });
  61.  
  62. now i got both id's so i can try to login..
  63.  
  64. const todo = {
  65. username: "admin",
  66. password: "123",
  67. token: "",
  68. rememberMe: "false"
  69. };
  70.  
  71. fetch('/API/ADSModule/Servers/4fb97e39-b5fe-44d7-8662-938abbd86f4b/Core/Login', {
  72. method: 'POST',
  73. body: JSON.stringify(todo),
  74. headers: {
  75. 'Content-type': 'application/json',
  76. 'accept': 'application/json',
  77. }
  78. })
  79. .then(response => response.json())
  80. .then(json => {
  81. console.log(json);
  82. });
  83.  
  84. this give me an error...
  85. VM638:1 Uncaught (in promise) SyntaxError: Unexpected end of JSON input
  86. at <anonymous>:16:32
  87.  
  88. i try different ways and no one is give me back an sessionid..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement