Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Resource URL
https://auspost.com.au/api/postage/parcel/domestic/weight
Headers
auth-key
required
GET
https://auspost.com.au/api/postage/parcel/domestic/weight.{format}

i can't able to send header with api link.
plsease give some example.
Posted

1 solution

With jQuery ajax methods you have two ways to set headers - those headers will be sent with the request...
1.
JavaScript
$.ajax({
  type: 'POST',
  url: 'https://auspost.com.au/api/postage/parcel/domestic/weight',
  headers: {
    "auth-key":"value"
    // more as you need
  }
});

2.
JavaScript
$.ajax({
  type: 'POST',
  url: 'https://auspost.com.au/api/postage/parcel/domestic/weight',
  beforeSend: function(xhr) {
    xhr.setRequestHeader("auth-key", "value"); 
    // more as you need
  }
});
 
Share this answer
 
Comments
utm 16-Dec-14 10:46am    
thanku very much..
RaisKazi 16-Dec-14 19:07pm    
My 5.
Kornfeld Eliyahu Peter 17-Dec-14 1:18am    
Thank you...
utm 17-Dec-14 0:30am    
$.ajax({
type: 'POST',
url: 'https://auspost.com.au/api/postage/country.json',
beforeSend: function (xhr) {
xhr.setRequestHeader("AUTH-KEY", "d1dc0329-5769-463b-af5f-84aea8d85218");

},

success: function () {
alert("success");
},
error: function () {
alert("Network error");
}
});

my above script is not working...it shows network error..please suggest
Kornfeld Eliyahu Peter 17-Dec-14 1:19am    
What error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900