HTTP Query Issue for Docusign

Hi All,

I am trying to use HTTP Query to get the status of document but I am getting following error:



[success:false,result:,error:[code:[category:0,namespace:1,detail:0],title:HTTP error connecting to demo.docusign.net/.../accounts 401 Unauthorized,detail:No details available]]


I am using the following expression:

a!httpQuery(
url: "demo.docusign.net/.../accounts",
method: "GET",
headers: a!httpHeader("name", a!scsField("httpvalue", "value", false)),
queryParameters: a!httpQueryParameter("IntegratorKey", a!scsField("integratorkey", "integrator", false)),
basicAuthenticationCredentials: a!httpAuthenticationBasic(a!scsField("Rishu_Username", "Username", false()),
a!scsField("Rishu_Password", "Password", false()),true())
)

Can anyone guide where I am getting it wrong?

Thanks
Rishu

OriginalPostID-243720

  Discussion posts and replies are publicly visible

  • Okay, I took a look at a process model I have that does this. In my case we were using the status parameter instead of the envelopeId, but maybe it will help. Here's what we had. Some of this was in separate rules (and I would recommend that) but I'm putting the expressions to make it easier for you to try.

    headers: {a!httpHeader(name: "Content-Type", value: "application/json"), a!httpHeader(name: "X-DocuSign-Authentication", value: a!toJson(
    {
    Username: <Your username>,
    Password: your password,
    IntegratorKey: <Your key>
    }
    ))}

    query parameters:
    {a!httpQueryParameter(name: "from_Date", value: rule!getDateToCheckForNewDocuSignUpdates()), a!httpQueryParameter(name: "status", value: {"declined", "completed"})}

    Request body was empty.

    rule!getDateToCheckForNewDocuSignUpdates():

    /* search based on the last time the update process should have run */
    text(
    /* make sure it's in utc */
    gmt(
    datetime(
    year(
    now()
    ),
    month(
    now()
    ),
    day(
    now()
    ),
    hour(
    now()
    ),
    minute(
    now()
    ) - 30
    ))
    /*needs to be ISO 8601 format */,
    "yyyy-MM-ddTHH:mm:ss") & ".000Z"


    That will tell DocuSign to look for envelopes updated to declined or completed in the last 30 minutes
  • Thank you so much Tyler, this did fix the error but in response, I did not get anything in result text. My response is { "resultSetSize": "0", "totalSetSize": "0", "nextUri": "", "previousUri": "", "envelopes": []}. When I tried "https://iodocs.docusign.com/" with same parameters, I am getting results.
  • That means no envelopes were updated in that timeframe. Were any envelopes either signed or completed? Or maybe the envelope was completed longer than 30 minutes ago? If you need to search farther back in the past than 30 minutes you can replace the - 30 in getDateToCheckForNewDocuSignUpdates to use some other number.
  • That is what I did Tyler. I even completed one form & also updated the time to -1439 to make sure that we get the "completed" form. I can see that in "https://iodocs.docusign.com/" but not in Appian.
  • Could you replace the response you get in iodocs?
  • {
    "resultSetSize": "2",
    "totalSetSize": "2",
    "startPosition": "0",
    "endPosition": "1",
    "nextUri": "",
    "previousUri": "",
    "envelopes": [
    {
    "status": "sent",
    "documentsUri": "/envelopes/180959e1-904a-40e2-9342-2d599e32023c/documents",
    "recipientsUri": "/envelopes/180959e1-904a-40e2-9342-2d599e32023c/recipients",
    "attachmentsUri": "/envelopes/180959e1-904a-40e2-9342-2d599e32023c/attachments",
    "envelopeUri": "/envelopes/180959e1-904a-40e2-9342-2d599e32023c",
    "envelopeId": "180959e1-904a-40e2-9342-2d599e32023c",
    "customFieldsUri": "/envelopes/180959e1-904a-40e2-9342-2d599e32023c/custom_fields",
    "notificationUri": "/envelopes/180959e1-904a-40e2-9342-2d599e32023c/notification",
    "statusChangedDateTime": "2016-11-03T21:16:45.2600000Z",
    "documentsCombinedUri": "/envelopes/180959e1-904a-40e2-9342-2d599e32023c/documents/combined",
    "certificateUri": "/envelopes/180959e1-904a-40e2-9342-2d599e32023c/documents/certificate",
    "templatesUri": "/envelopes/180959e1-904a-40e2-9342-2d599e32023c/templates"
    },
    {
    "status": "completed",
    "documentsUri": "/envelopes/d92f993e-4b68-4f0b-94d5-0a6e28fd033e/documents",
    "recipientsUri": "/envelopes/d92f993e-4b68-4f0b-94d5-0a6e28fd033e/recipients",
    "attachmentsUri": "/envelopes/d92f993e-4b68-4f0b-94d5-0a6e28fd033e/attachments",
    "envelopeUri": "/envelopes/d92f993e-4b68-4f0b-94d5-0a6e28fd033e",
    "envelopeId": "d92f993e-4b68-4f0b-94d5-0a6e28fd033e",
    "customFieldsUri": "/envelopes/d92f993e-4b68-4f0b-94d5-0a6e28fd033e/custom_fields",
    "notificationUri": "/envelopes/d92f993e-4b68-4f0b-94d5-0a6e28fd033e/notification",
    "statusChangedDateTime": "2016-11-03T21:18:29.7470000Z",
    "documentsCombinedUri": "/envelopes/d92f993e-4b68-4f0b-94d5-0a6e28fd033e/documents/combined",
    "certificateUri": "/envelopes/d92f993e-4b68-4f0b-94d5-0a6e28fd033e/documents/certificate",
    "templatesUri": "/envelopes/d92f993e-4b68-4f0b-94d5-0a6e28fd033e/templates"
    }
    ]
    }
  • Hmm, okay. And you could paste the output of getDateToCheckForNewDocuSignUpdates()? It looks like something might be going wrong there.

    If you remove that query parameter in Appian so that you're only using the status parameter, do you get envelope 92f993e-4b68-4f0b-94d5-0a6e28fd033e back?
  • Tyler, Yes, Looks like the issue was with from date, I removed from date & used envelopeid instead & it returned the correct response. In the rule "getDateToCheckForNewDocuSignUpdates()", I used following expression:
    text(
    /* make sure it's in utc */
    gmt(
    datetime(
    year(
    now()
    ),
    month(
    now()
    ),
    day(
    now()
    ),
    hour(
    now()
    ),
    minute(
    now() - 1439
    )
    ))
    /*needs to be ISO 8601 format */,
    "yyyy-MM-ddTHH:mm:ss") & ".000Z"

    The output of rule was:
    2016-11-03T21:22:00.000Z