I am trying to update the invoice template of an Xero invoice. My issue is that I get a 400 error and a response saying:
NoDataProcessedException No data has been processed for this endpoint. This endpoint is expecting Invoice data to be specifed in the request body
So my authentication works perfectly but its claiming that I have no data in the body of my post request. As you can see in my code below I have specified data in the body of the request. So have I just formatted it wrong or am I doing something else wrong?
$xeroInvoiceId = '7b601c90-642b-4b6c-9a21-3969ff339cb0';
$updateInvoiceArgs = array(
'headers' => array(
'xero-tenant-id' => $tenantId,
'Authorization' => 'Bearer ' . $refreshTokenBody->access_token,
),
'body' => array(
'InvoiceID' => $xeroInvoiceId,
'BrandingThemeID' => '5d4dd402-c851-497e-aae1-9ff265c0d15a'
)
);
$res = wp_remote_post('https://api.xero.com/api.xro/2.0/Invoices/' . $xeroInvoiceId, $updateInvoiceArgs);
var_dump($res);