PHP Classes

Xero oauth POST

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement PHP ...  >  All threads  >  Xero oauth POST  >  (Un) Subscribe thread alerts  
Subject: Xero oauth POST
Summary:cannot POST oath Xero
Messages:2
Author:Alexis RIbault
Date:2015-05-08 05:47:19
 

  1. Xero oauth POST   Reply   Report abuse  
Picture of Alexis RIbault Alexis RIbault - 2015-05-08 05:47:19
Hello,

I successfully connected to Xero API,
But I am currently stuck to POST an invoice using XML.

$url = 'xml/invoice.xml';
$xml = simplexml_load_file($url);

$success3 = $client->CallAPI(
'https://api.xero.com/api.xro/2.0/Invoices',
'POST', array('format'=>'text/xml','File'=>$xml), array('FailOnAccessError'=>true, 'DecodeXMLResponse'=>'simplexml'), $user3);

This is the code that I have, but I am not sure if this works that way.
This is the error I get as a response.

SimpleXMLElement Object
(
[ErrorNumber] => 17
[Type] => NoDataProcessedException
[Message] => No data has been processed for this endpoint. This endpoint is expecting Invoice data to be specifed in the request body.
)

Cheers,
Alexis

  2. Re: Xero oauth POST   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-05-20 00:34:15 - In reply to message 1 from Alexis RIbault
If CallAPI function call returned true, that is because the response status code was 2XX and so it succeeded.