PandaDOC API PHP issue


PandaDOC API PHP issue

我一直在为发送我们的客户合同而与pandadocneneneba API打交道。

我已经能够让它工作并传递电子邮件和收件人信息,但我无法在自定义字段中添加它。我试过各种各样的方法。

以下是他们说我需要提出的请求:

{
"name": "Sample Document",
"url": "URL_TO_A_DOCUMENT",
"recipients": [
    {
        "email": "john.appleseed@yourdomain.com",
        "first_name": "John",
        "last_name": "Appleseed",
        "role":"u1"
    },
    ...
],
"fields": {
    "optId": {
        "title": "Field 1"
    }
 }
}

以下是我的PHP中的内容:

function create_pandadoc($access_token, $array){ 
        $url = 'https://api.pandadoc.com/public/v1/documents';
        $docurl = "http://www.mydomain.co.uk/pandadoc/marktest.pdf";
        $postfields = array();
        $postfields['name'] = 'Contract Name';
        $postfields['url']  = $docurl;
        $postfields['recipients'] = array(
            array(
                'email'      => 'customer@customeremail.com',
                'first_name' => 'John',
                'last_name'  => 'Appleseed',
                'role'       => 'u1'
            )
        );
       $postfields['fields'] = array(
            'plFirstname' => array(
                'First Name' =>  'John'
            )
            );

如果我注释掉字段部分,它会很好地传递到正确的电子邮件,客户可以签名,但我也需要能够传递相关的自定义字段。

这是API文档的链接。

https://developers.pandadoc.com/

也许你已经解决了这个问题,但对于任何寻找答案的人来说,我发现这是可行的:

"fields": {
   "fieldId": {
       "assignee": "role@email.com", // email of the person who has to fill the field (if needed)           
       "value": "The value for the field",
       "title": "Title for the field"
     }, 
...
}