Posting to an OData service using json?


  • For the life of me I can't successfully post data to my OData service at sqlazurelabs, in order to create a new record.  If there is an example somewhere, using JSON, I would greatly appreciated it.

    I'm currently using anonymous access, but will lock it down once it's working.

    I keep getting a 415 (Unsupported Media Type) response from the server.

    Here is an example of what I'm doing...

    var oInData = {"field1":"value1",field2":"value2"};
    	url: g_oConfig.DataServer.ODataEndPoint + "/Inspections?$format=json",
    	type: "POST",
    	dataType: "application/json",
    	data: JSON.stringify( oInData ),
    	success: function(data) {
    	error: function(jqXHR, textStatus, errorThrown) { 
    			JSON.stringify(textStatus) + " | " + 

    Wednesday, June 08, 2011 11:15 AM

All replies