WCF 4.0 Restful URl

时间:2011-05-19 11:13:07

标签: wcf rest

如何能够在基于ron jacobs tutorial的wcf 4.0 restful服务上使用以下格式的apikey

Example /customer/{apikey}/{other or no parameter}

Currently am only able to achieve the following /customer?apikey=8484734739-43948&parm2=ui

2 个答案:

答案 0 :(得分:0)

警告:我不做Jquery,我在一些随机网站上复制了这个并稍微改了一下。

jQuery.ajaxSetup({
    'beforeSend': function(xhr) {xhr.setRequestHeader("Authorization", "myapikey 8484734739-43948")}
})

答案 1 :(得分:0)

仅供参考:

要将api密钥附加到所有请求,请使用以下代码:

jQuery.ajaxSetup({
  data: {
    apiKey: '8484734739-43948'
    ,parm2: 'ui'
  }
});