perkinsb | Posts: 8

add a field onto an existing package id

0 votes

Hello. I am new to using Onespan Sign API. I am using Rest API and Postman to enter and execute the code. Please see the below code. I am trying to add a field onto an existing package id. I have included the details below. How do I add a field to a Onespan Package? Can you please send me a complete code sample? I am new to using the API and still learning, so I do not know how to enter peice by peice yet. 
curl -X 'POST' \
'https://sandbox.esignlive.com/api/packages/WlnHZN0WH1xKX6GHGTFbQtGPBJg=/documents/cec7f9fa480589d46a91944ca2b4e8921df2aaef094ae042/approvals/MfSNKUFMhHIB/fields' \
  -H 'accept: application/json' \
  -H 'Authorization: Basic api_key'


Duo_Liang | Posts: 3776

Reply to: add a field onto an existing package id

0 votes

Hi Brian,

 

Use this API to add field to an existing document:

POST https://sandbox.esignlive.com/a/api/packages/NQf-umVQcBZ_u6_J041ldBsmG9g=/documents/61679d27dc1e9693588bbe2fe322ee8fdb6d04be892399a9/approvals/EAIAmvnpYOkA/fields

Example Payload:

{

  "id": "date_field",

  "name": "date_field",

  "type": "INPUT",

  "subtype": "LABEL",

  "value": "2023-01-01",

  "page": 0,

  "width": 269.9928097345133,

  "height": 59.986172566371685,

  "top": 694.5371497050148,

  "left": 275.8079830383481

}

 

Duo


perkinsb | Posts: 8

Reply to: add a field onto an existing package id

0 votes

Hi Duo. What would the complete code look like? I tried the below and am getting an error message.

curl -X PUT -H "Content-Type: application/json" \
  -H "Accept: application/json; esl-api-version=11.21" \
  -H "Authorization: Basic api_key" \
  -d '{ "id": "date_field", "name": "date_field", "type": "INPUT", "subtype": "LABEL", "value": "2023-01-01", "page": 0, "width": 269.9928097345133, "height": 59.986172566371685, "top": 694.5371497050148, "left": 275.8079830383481 }' \
  https://sandbox.esignlive.com/api/packages/WlnHZN0WH1xKX6GHGTFbQtGPBJg=/documents/cec7f9fa480589d46a91944ca2b4e8921df2aaef094ae042/approvals/MfSNKUFMhHIB/fields

 

result error meesage: 

{"messageKey":"http.status.405","message":"Method Not Allowed","code":405,"name":"Method Not Allowed"}
 


Duo_Liang | Posts: 3776

Reply to: add a field onto an existing package id

0 votes

Hi Brian,

 

Try to use POST method instead of PUT:
curl -X POST -H "Content-Type: application/json" -d "{ \"id\": \"date_field\", \"name\": \"date_field\", \"type\": \"INPUT\", \"subtype\": \"LABEL\", \"value\": \"2023-01-01\", \"page\": 0, \"width\": 269.9928097345133, \"height\": 59.986172566371685, \"top\": 694.5371497050148, \"left\": 275.8079830383481 }"  -H "accept: application/json"  -H "Authorization: Basic your_api_key"  https://sandbox.esignlive.com/a/api/packages/xP0sAyTG86iUg1phux3wd49TfJs=/documents/3893e877707f006517f46cc37150061dc3a6874c1d616fad/approvals/Signature1/fields

 

Duo


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off