Editing Field Values using /api/packages/{packageId}/clone right
Sunday, November 11, 2018 at 05:11pmCurrently trying to customize my package.... It is an existing template on my sandbox and I would like to be able to customize the fields each time I clone the package. Is this possible?
This is the current JSON payload I am sending... the signer information works but the fields are not working. They are "Labels" on my template with Name's as shown in the fields portion and no value.
      
                                    
    var payload = {
      "status": "SENT",
      "name": "Package created from template through REST API",
      "roles":
        [
          {
            "id": "5e4f1718-24f2-424f-94bc-9de4bc183680",
            "signers":
              [
                {
                  "id": "placeholderId2",
                  "firstName": "Nicole",
                  "lastName": "Weese",
                  "email": "[email protected]",
                }
              ]
          }
        ],
      "documents":
        [
          {
            "id": "default-consent"
          },
          {
            "fields":
              [
                {
                  "extract": true,
                  "value": "12345678790",
                  "name": "SSN"
                },
                {
                  "extract": true,
                  "value": "12345678790",
                  "name": "SSN2"
                },
                {
                  "extract": true,
                  "value": "12345678790",
                  "name": "recipientPhone"
                },
              ],
            "extract": true,
            "id": "f13e975b4404f250fb68feefd3db66f3d225c2dfb0840838",
          },
        ]
    }
Reply to: Editing Field Values using /api/packages/{packageId}/clone right
Monday, November 12, 2018 at 02:27am"documents": [ { "approvals": [ { "fields": [ { "type": "SIGNATURE", "extract": true, "subtype": "FULLNAME", "name": "Signature1" }, { "name":"SSN1", "extract":true, "type":"INPUT", "value":null, "subtype":"LABEL" } ], "role": "Signer1" } ], "extract": true, "name": "Sample Contract" } ]#2. every time you created package from template: First, you leave the package status to "DRAFT"; Then you set values for labels fields by updating them. Currently, there's no batch updating fields API, so I guess you will have to update your fields one by one calling this API (you can use field's name to identify it when looping through all your fields):PUT /api/packages/{packageId}/documents/{documentId}/approvals/{approvalId}/fields/{fieldId} use modified value as payloadFinally, sent your package. Hope this could help! DuoReply to: Editing Field Values using /api/packages/{packageId}/clone right
Monday, November 12, 2018 at 08:18amvar payload = { "status": "DRAFT", "name": "Package created from template through REST API", "roles": [ { "id": "5e4f1718-24f2-424f-94bc-9de4bc183680", "signers": [ { "id": "placeholderId2", "firstName": "Nicole", "lastName": "Weese", "email": "[email protected]", } ] } ], "documents": [ { "id": "default-consent" }, { "id": "f13e975b4404f250fb68feefd3db66f3d225c2dfb0840838", "approvals": [ { "fields": [ { "type": "SIGNATURE", "extract": true, "subtype": "FULLNAME", "name": "Signature1" }, { "name":"dateOfBirth", "extract":true, "type":"INPUT", "value":null, "subtype":"LABEL" } ], "role": "Signer1" } ], "extract": true, "name": "Sample", }, ] }is this correct? Should role be placeholderId2? For your PUT route, you said /fields, but say there is no batch field value editing. Does this mean that my payload needs to have an id attached to it?let updatePayload = { "name": "dateOfBirth", "data": null, "id": "g2AWMEVZaY42", "top": 323.0, "left": 289.0, "width": 208.0, "height": 25.0, "page": 2, "type": "INPUT", "value": "June 2 1992", "binding": null, "subtype": "LABEL" }or should I be hitting the /fields/{fieldId} with a simplifiied JSON objectlet updatePayload = { "name": "dateOfBirth", "value": "June 2 1992", }Reply to: Editing Field Values using /api/packages/{packageId}/clone right
Monday, November 12, 2018 at 08:28am"documents": [ { "approvals": [ { "fields": [ { "type": "SIGNATURE", "extract": true, "subtype": "FULLNAME", "name": "Signature1" }, { "name":"SSN1", "extract":true, "type":"INPUT", "value":null, "subtype":"LABEL" } ], "role": "Signer1" } ], "extract": true, "name": "Sample Contract" } ]#1. This example I sent is for creating templates with label fields instead of using field injection, and you also need to assign field ID here. #2. when making clone call, you can't specify label values, so that's why I said you'll have to update your label fields one by one after clone your template and leave it in DRAFT. #3. the PUT call to update label fields should include/fields/{fieldId}to specify which field you want to update, it was a mistake made by me. And the payload should be a fully dressed one instead of simplified one. Duo