我们如何调用Availity API

时间:2017-03-09 03:32:17

标签: javascript jquery webrequest

目前,我正在尝试通过JavaScript调用Availity API。这是cURL电话:

curl -i -H "x-api-key: $API_KEY" -H "Content-Type: application/json" -X POST https: //api.availity.com/demo/v1/institutional-claims -d {
"requestTypeCode": "PRE_DETERMINATION",
"billingProvider": {
    "npi": "1234567893",
    "ein": "111222333",
    "payerAssignedProviderId": "XYZ321"
},

我使用的是有效密钥,但结果是HTTP 404错误。

我尝试使用jQuery.ajax,但它无法正常工作。此外,我尝试使用C#WebRequest进行此调用,但它也不起作用。

是否可以从jQuery / JavaScript或C#调用此API?

var tempk = {
        "requestTypeCode": "PRE_DETERMINATION",
        "billingProvider": {
            "npi": "1234567893",
            "ein": "111222333",
            "payerAssignedProviderId": "XYZ321"
        },
        "patient": {
            "relationshipCode": "01",
            "lastName": "Smith",
            "firstName": "Bob",
            "stateCode": "FL",
            "birthDate": "1980-02-12",
            "genderCode": "M"
        },
        "payer": {
            "id": "BCBSF"
        },
        "submitter": {
            "id": "123456789",
            "lastName": "SUBMITTER"
        },
        "subscriber": {
            "memberId": "JDH001",
            "groupName": "ASDF 1-2",
            "groupNumber": "12312412"
        },
        "claimInformation": {
            "placeOfServiceCode": "11",
            "diagnoses": [
              {
                  "qualifierCode": "ABK",
                  "code": "J3089"
              }
            ],
            "serviceLines": [
              {
                  "procedureCode": "92523",
                  "quantity": "100",
                  "amount": "250",
                  "fromDate": "2016-05-10"
              }
            ]
        }
    };

       $.ajax({
        url: 'https://api.availity.com/demo/v1/professional-claims',
        dataType: "json",
        type: "POST",
        headers: {
            'x-api-key': 'xxxxxxxxxxx'
        },
        data:tempk,
        //"x-api-key: $API_KEY"
        contentType: "application/json",
        success: function (jsonData) {
            // Success callback
            alert(jsonData);
        },
        error: function () {
            //any error to be handled
        }
    });

0 个答案:

没有答案