inventory_level/set.json html response

New Member
1 0 0

HI, guys, 

first, i am up to date with other posts regarding cookies in the session.

i work with an app which at some point throws a JS in place. i did a lot of integrations in this manner.

i even manage to create products in shopify, update products, update variants with no problem.

but now i am trying for a lot of time to set the inventory level using ES5 (i think is 5).

the request works on SoapUI (not key:pass@hostname but with the header Authorization: Basic base64 thingy)

what doesn`t work is the basic AJAX request below:

(feel free to use the code if you want. it usually works )

as you can see, i tried a lot of headers (all the combinations you see below).

as a response, i get the <html><body><noscript><a href=">continue</a> and a redirect to the same url (i think is the login/authentication page).





var myData = JSON.parse('{"location_id": 643080889,"inventory_item_id": 43501817,"available": 30}');
var parms = {};

parms.url 		= '';
parms.async 	= false;
parms.method 	= 'POST'; 	= JSON.stringify(myData);

var myVariant = shopify_sendDataToShopify(parms);

function shopify_sendDataToShopify(objData){
	var data;
	var dm = new shopify_ajaxCall(objData);
	dm.onSuccess = function(reply) {
				var data = reply;
	dm.onError = function(err){	}
	return data;

function shopify_ajaxCall(objParms) {
	this.onSuccess = function(){};
	this.onNoReply = function(){};
	this.onError= function(){};
	this.request= null;
	var me= this;
	this.execute =
		function() {
			this.url = objParms.url;
			this.request = new ActiveXObject("MSXML2.XMLHTTP");, objParms.url, objParms.async);
			//this.request.setRequestHeader("Authorization","Basic YzE4MDU0NWM4Y2FlODZsomefMDljMWYxYWI2YjODQ3YTM2NWVkOWY=");
			//this.request.setRequestHeader("Content-type", "application/json");
			//this.request.setRequestHeader("User-Agent","Apache-HttpClient/4.5.5 (Java/12.0.1)");
				function() {
					if (me.request.readyState==4) {
						if (me.request.status==200){
			try {
			catch(e) {







Replies 0 (0)