How To Pass JSON to a WebGet

50 views Asked by At

I have the following WebGet:

    [WebGet(UriTemplate = "GetAssignments/{data}")]
    [Description("GetAssignments")]
    BASE.BaseResponse<object> GetAssignments(String data); 

Called thusly:

    var data = JSON.stringify(advancedSearchDataXml);

    Helper.Service.Call({
        api: 'HomeApi',
        url: '?method=GetAssignments/' + data,
        method: 'GET',
        //data: advancedSearchDataXml,
        controlId: '',
        showProgress: true,
        onSuccess: function (result) {
    ...

where data is

{"searchquery":
    "<SearchQuery>
        <genericsearch></genericsearch>
        <region>MA</region><market>RL</market>
        <recordcount>5000</recordcount>
    </SearchQuery>"
}

This fails with a "EXCEPTION: The remote server returned an error: (400) Bad Request" message. What am I doing wrong?

1

There are 1 answers

2
DonO On

Try removing the ?method= instead have only 'GetAssignments/'+ data .. also add a break point in your controller to make sure the right method is being hit.