Skip to main content
Participant
April 21, 2023
Question

Issues With Creating an Agreement With the API

  • April 21, 2023
  • 1 reply
  • 681 views

I have Issues With Creating An agreement from a transientdocument which is a PDF uploaded through the api. To upload the file, this is my current code implementation:

 

headers = {
    'Authorization': f'Bearer {ACC_TOKEN}',
    # 'Content-Type': 'multipart/form-data',
    'Content-Disposition': 'form-data; name="Test RateConf PDF"; filename="MyPDF.pdf"'
}
file = {
    'File-Name': 'Test RateConf PDF',
    'File': open('MyPDF.pdf','rb')
}

updoc = requests.post(f"{API_AP}api/rest/v6/transientDocuments",files=file,headers=headers)
print(updoc.text)

# The agreements code
headers = {
  'Authorization': f'Bearer {ACC_TOKEN}',
  'Content-Type': 'application/json'
}

params = {
  "fileInfos": [
    {
      "transientDocumentId": the_transcientdocumentID
    }
  ],
  "name": "Test conf pdf",
  "participantSetsInfo": [
    {
      "order": 1,
      "role": "SIGNER",
      "memberInfos": [
        {
          "email": "myemail@outlook.com"
        }
      ]
    }
  ],
  "signatureType": "ESIGN",
  "state": "AUTHORING"
}

r = requests.post(f"{API_AP}api/res/v6/agreements",headers=headers)
print(r.text)

With the above i'm able to get the transientDocuments ID but not when i uncomment the 'Content-Type' in the header. After doing this, when i try to create an agreement from the transientDocumentsID, i always get a "<Response [404]>
{"code":"NOT_FOUND","message":"Resource not found"}". And whenever i try to use other endpoints of the agreement with the transientDocumentID, i later always get a mail from adobe attached as well. Have tried using a different pdf file incase its the cause of the issue but its still the same behavior. However, when i upload the pdf through the dashboard, i don't experience any issues. How can i have this solved? Thanks in advance.

This topic has been closed for replies.

1 reply

atsmusz_as_dsEng
Adobe Employee
Adobe Employee
April 26, 2023

Hi There.

 

According to youranswer in Transient Document uploaded Programmatically is Al... - Adobe Support Community - 13747215 I believe the issue here was the file mimie type.

 

Please mark as answered if you get a chance?

Aaron Smusz - Data Science Engineering - Adobe Acrobat Sign