locked
how to get entity using post method instead of get RRS feed

  • Question

  • User1800555377 posted

    I want to use upshot remoteDataSource to get data. Parameters are exceeding limit so I used  [Query(HasSideEffects=true)] so I can use post method on RIA service. 

    now I want to call same method using upshot remoteDataSource ....but it fails. Its calling method using 'GET' . is there any way to to use 'POST' ?

    Saturday, July 14, 2012 6:38 AM

All replies

  • User-661350001 posted

    you may add the data to a hidden element and submit and access it the data using post method

    Saturday, July 14, 2012 6:48 AM
  • User1364817430 posted

    Hi,

    For what I have seen, this is nog possible. Retrieving data is done by the default type of an AJAX request and that is GET. What you can try is the following:

    1. In the upshot.js file, look for the DataProvider.ria.js
    2. In that part go to the var instance members and look for the get method
    3. In there you have an ajax call: change this so it uses the type: "POST"
    $.ajax({
        url: upshot.DataProvider.normalizeUrl(parameters.url) + "json/" + operation,
        data: $.extend({}, transformParameters(operationParameters), transformQuery(queryParameters || {})),
        success: success && function () {
             arguments[0] = getQueryResult(arguments[0]);
             success.apply(self, arguments);
        },
        error: error && function (jqXHR, statusText, errorText) {
             error.call(self, jqXHR.status, self._parseErrorText(jqXHR.responseText) || errorText, jqXHR);
        },
        dataType: "json",
        type: "POST"
    });
    

    Try this, I don't know if it will work, but it think it will. Ofcourse don't forget to add an attribute on the function you call in the service.

    greetings

    Kristof

    Thursday, July 26, 2012 2:20 AM