Calling external rest service: (Native Mobile)

0
I cannot call rest service in nanoflow and also cannot call a microflow in native page. Please tell us the best way to integrated web service in native pages in mendix
asked
1 answers
0

Try with a javascript action

/**
 * @param {string} uRL
 * @param {string} method
 * @param {string} headers
 * @param {string} body
 * @returns {Promise.<string>}
 */
export async function CallRestService(uRL, method, headers, body) {
	// BEGIN USER CODE
	if ( typeof headers == "undefined" || headers == null ) headers = "{}"; 
	try {
		headers = JSON.parse(headers);
	}
	catch ( err ) {
		throw new Error("Headers are not valid JSON because: "+err.message);
	}
	const response = await fetch(uRL, {
		method: method,
		headers: headers,
		body: body
	});
  	const responseBody = await response.text();
	return responseBody;
	// END USER CODE
}

 

https://www.notion.so/gajduk/Hosting-b4025782198b494ba6bd053953c8933b#0e6ee47d773d44498570054e4fc464a5https://www.notion.so/gajduk/Hosting-b4025782198b494ba6bd053953c8933b#0e6ee47d773d44498570054e4fc464a5

 

 

answered