通过 API [Invoice APP] 创建项目时出现 PodioBadRequestError
PodioBadRequestError when creating a item via API [Invoice APP]
我正在通过 API 在 PODIO 应用程序中创建一个项目,我可以为 3 个应用程序(客户端、行项目和索赔)创建一个项目,但我无法在 Invoice APP 上创建一个项目,我每次都收到 "PodioBadRequestError" 错误,而我在其他应用程序上做同样的事情。
我正在使用 PHP 库。
这是我正在使用的脚本的一部分:
$newInvoice = array('fields'=>array(
'date-created' => '2018-07-23',
'third-party' => '5',
'due-date' => '2018-07-28'
));
Podio::setup($clientID, $clientSECRET);
Podio::authenticate_with_app($invoiceAPPID, $invoiceAPPToken);
Podio::set_debug(true);
$invoice = PodioItem::create($invoiceAPPID, $newInvoice);
能否请您查看我的请求并指导我哪里做错了。
谢谢
您传递的值格式错误。
如果date-created
和due-date
是跑道的日期字段,那么你必须把日期写成'Y-m-d H:i:s'
格式,然后传给'start'
键.
试试这个,
$newInvoice = array('fields'=>array(
'date-created' => array('start'=>date('Y-m-d H:i:s', strtotime('2018-07-23'))),
'third-party' => 5,
'due-date' => array('start'=>date('Y-m-d H:i:s', strtotime('2018-07-28')))
));
//third-party is an integer field
我正在通过 API 在 PODIO 应用程序中创建一个项目,我可以为 3 个应用程序(客户端、行项目和索赔)创建一个项目,但我无法在 Invoice APP 上创建一个项目,我每次都收到 "PodioBadRequestError" 错误,而我在其他应用程序上做同样的事情。
我正在使用 PHP 库。
这是我正在使用的脚本的一部分:
$newInvoice = array('fields'=>array(
'date-created' => '2018-07-23',
'third-party' => '5',
'due-date' => '2018-07-28'
));
Podio::setup($clientID, $clientSECRET);
Podio::authenticate_with_app($invoiceAPPID, $invoiceAPPToken);
Podio::set_debug(true);
$invoice = PodioItem::create($invoiceAPPID, $newInvoice);
能否请您查看我的请求并指导我哪里做错了。
谢谢
您传递的值格式错误。
如果date-created
和due-date
是跑道的日期字段,那么你必须把日期写成'Y-m-d H:i:s'
格式,然后传给'start'
键.
试试这个,
$newInvoice = array('fields'=>array(
'date-created' => array('start'=>date('Y-m-d H:i:s', strtotime('2018-07-23'))),
'third-party' => 5,
'due-date' => array('start'=>date('Y-m-d H:i:s', strtotime('2018-07-28')))
));
//third-party is an integer field