Tekstwaarden die de tekens &, <, of > bevatten, dienen ge-escaped te worden volgens de XML-standaard, anders is de XML ongeldig:
curl -X POST "https://api.masterbalance.app/v1/[group]/[action]/" \ -H "Content-Type: application/xml" \ --data-binary @invoice.xml of curl -X POST "https://api.masterbalance.app/v1/[group]/[action]/" \ -H "Content-Type: application/xml" \ -d '<?xml version="1.0" encoding="UTF-8"?><document>...</document>'
$xmlString = '<?xml version="1.0" encoding="UTF-8"?>
<document>
<contract>
<apikey>[yourapikey]</apikey>
</contract>
</document>';
$url = "https://api.masterbalance.app/v1/[group]/[action]/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/xml"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlString);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);
echo $response;const xmlString = `<?xml version="1.0" encoding="UTF-8"?>
<document>
<contract>
<apikey>[yourapikey]</apikey>
</contract>
</document>`;
fetch("https://api.masterbalance.app/v1/[group]/[action]/", {
method: "POST",
headers: {
"Content-Type": "application/xml"
},
body: xmlString
})
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));import requests
xml_string = '''<?xml version="1.0" encoding="UTF-8"?>
<document>
<contract>
<apikey>[yourapikey]</apikey>
</contract>
</document>'''
url = "https://api.masterbalance.app/v1/[group]/[action]/"
headers = {"Content-Type": "application/xml"}
response = requests.post(url, data=xml_string.encode("utf-8"), headers=headers, timeout=30)
print(response.text)