Gautam Parmar

Gautam Parmar

  • NA
  • 867
  • 21.9k

Rest API Using Authorization Key

Oct 9 2017 1:41 AM
This is first time i have started working on Rest API's
 
I have tried a lot to find resources but couldnt achieve
 
as per documentation This has to be my request header and request will be POST
 
" Authorization":"125THIS123IS123TEST1354",
"cache-control":"no-cache",
"content-type":"application/json"
 
I have tried alot to send data but got 401 Unauthorized error.
 
  1. $.ajax({       
  2.            type: "POST",    
  3.            url: 'https://testurl/api/test',    
  4.            headers: {    
  5.                'Authorization''125THIS123IS123TEST1354',    
  6.                'content-type''application/json',    
  7.                'cache-control''no-cache'    
  8.            },    
  9.            success: function (data) {    
  10.                alert('success')  
  11.            },    
  12.            failure: function (msg) {    
  13.                alert(msg);    
  14.            }    
  15.        });    
I dont know am going on right way or is ther eany other method..... 

Answers (5)