Skip to Content
0
Jan 29, 2020 at 05:16 PM

Consume the multichain service with UI5 app

76 Views

I have tried several ways of calling the multichain service with no success. I am using a trial account and I have consistently got the same error. Has anybody had any luck making this work?

getListStreams: function () {
			debugger;


			var mListStreams = new sap.ui.model.odata.v2.ODataModel(
				"myURL");
			mListStreams.setHeaders({
				"apikey": "myKey",
				"Content-Type": "application/json"
			});


			var mParameters = {
				"method": "liststreams"
			}
			mListStreams.read("/", [mParameters])


			var oData = {
				"method": "liststreams"
			};
			mListStreams.create("", oData);
			mListStreams.post({
				uri: "myURL",
				json: true,
				headers: {
					apikey: "myKey"
				},
				body: {
					"method": "liststreams"
				}
			});


		},


		getListStreams2: function () {
			debugger;


			jQuery.ajax({
				type: "POST",
				url: "myURL", //"/blockchainasset/*******************************/rpc",
				beforeSend: function (request) {
					request.setRequestHeader("apikey", "myKey");
				},
				data: JSON.stringify({
					"method": "liststreams"
				}),
				dataType: "json",
				contentType: "application/json",
				success: function (data, textStatus, jQxhr) {
					debugger;
					console.log(data);
				},
				error: function (jqXhr, textStatus, errorThrown) {
					debugger;
					console.log(errorThrown);
				}
			});
		},


		getListStreams3: function () {
			debugger;
			$.ajax({
				headers: {
					"apikey": "myKey"
				},
				method: "GET",
				url: "myURL",
				dataType: "JSON"
			}).done(function (data) {
				debugger;
				console.log(data);
			});
		} 

Attachments

captur1e.png (11.4 kB)