DocuSign Api creating envelope in Production - docusignapi

I have a problem with creating Envelope through the Api.
The authorization is performed without errors.
$options = new \DocuSign\eSign\Api\AuthenticationApi\LoginOptions();
$loginInformation = $authenticationApi->login($options);
I get this in response:
LoginInformation {
#container: array:2 [
"api_password" => null
"login_accounts" => array:1 [
0 => LoginAccount {
#container: array:11 [
"account_id" => "xxxxx"
"account_id_guid" => null
"base_url" => "https://na2.docusign.net/restapi/v2/accounts/xxxxx"
"email" => "xxxxx#xxxxxx.com"
"is_default" => "true"
"login_account_settings" => null
"login_user_settings" => null
"name" => "xxxxxxx, LLC"
"site_description" => ""
"user_id" => "xxxxxxxxxxxxxxxxxxx"
"user_name" => "xxxxxx Contracts Team"
]
}
]
]
}
But when I’m trying to create the Envelope this way:
$envelopeApi->createEnvelope($this->config->getAccountId(), $envelop_definition, $options);
I get this error: «[401] Error connecting to the API (https://www.docusign.net/restapi/v2/accounts/xxxxx/envelopes)”
This error notifies me that I’m not authorized. This code works properly in Sandbox.
I think that the problem is in settings of account - maybe there is a lack of special rights...

You need to use the right production platform. The right production platform is determined by the DocuSign Account ID.
See step 1 in the Post Go Live document.

Related

Unable to call `/oauth2/v2.0/token` even with the correct redirect/reply URL

I am following this document and currently stuck at 3rd step, Get a token:
I have no issue with the 2nd step, Get authorization as I could sign in (from the browser) and it responded with the code for the next step (3rd step).
BUT when it gave me the response below when sending a POST request (/common/oauth2/v2.0/token):
{
"error": "invalid_client",
"error_description": "AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: 'afef958a-7070-4b2d-9006-65b28c9aed43'.\r\nTrace ID: 2e478767-2adc-468c-b716-6134ca2d3a04\r\nCorrelation ID: 7117f8d0-2a9f-4110-8257-b32753876afb\r\nTimestamp: 2022-01-06 08:22:48Z",
"error_codes": [
50011
],
"timestamp": "2022-01-06 08:22:48Z",
"trace_id": "2e478767-2adc-468c-b716-6134ca2d3a04",
"correlation_id": "7117f8d0-2a9f-4110-8257-b32753876afb",
"error_uri": "https://login.microsoftonline.com/error?code=50011"
}
My request in Postman here
My Azure config here
My response on browser here
My code (PHP):
$response = $client->request(
"POST",
"/common/oauth2/v2.0/token",
[
"headers" => [
"Content-Type" => "application/x-www-form-urlencoded",
],
"form_params" => [
"tenant" => $tenantId,
"client_id" => $clientId,
"grant_type" => "authorization_code",
"scope" => "User.Read",
"code" => $_GET["code"],
"redirect_uri" => $replyUrl,
"client_secret" => $clientSecret,
]
]
);
Note:
I have tried with Accounts in any organizational directory and Accounts in any organizational directory and personal Microsoft accounts, both of them are giving me the same response
I am sure the client secret is correct
I am sure the redirect/reply URL is correct too
I have done enough research online, but no similar solutions that could solve this issue
This occurs when the login code in your app (js/ts) is not setting the redirectUrl value to something that matches what your app is configured to answer as a redirect Url in your Azure portal. You haven't sent enough code to see what your redirect looks like, but it's not clear why you're doing it by hand (instead of using MSAL), and also why you've tagged this as "microsoft-teams" - this is important because, if you are building a Teams tag, then the usual process is a little different for Teams.
Update: the original question makes it clear now that this is a PHP scenario, which my answer above does not address - fyi to anyone reading this answer.

Yii2 routing problems,don't recognise parameters

Every time a make request to http://localhost/users?username="john.doe", I get 404 error.
The following code is Controller code to control routes.
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'only' => [ 'users'],
'rules' => [
[
'actions' => ['users'],
'allow' => true,
'roles' => ['#'],
]
]
],
];
}
Controller action code.
public function actionUsers($username)
{
if (Yii::$app->request->isAjax) {
return Users::find()->where('username', $username)->one();
}
}
PS: I'm make ajax request.
Assuming you action actionUsers is inside a controller name MyuserController then your link should be
http://localhost/myuser/users?username="john.doe"
Your link must contain also the name of the controller (not only the name of the action)

Docusing error with Attaching through REST API documentBase64 - even for the small file

I have a Issue with docusign attachment through REST API. It was perfectly worked previously but the following error message coming,
{
"errorCode": "UNABLE_TO_CONVERT_DOCUMENT",
"message": "System was unable to convert this document to a PDF. Unab (truncated...)
If you can please help me on this
Bellow is the code segment which I'm using for attach image file to the docusign.
if(isset($this->attachments['NIC_Rear']))
{
array_push($dataArray['compositeTemplates'],
[
'inlineTemplates' => array(
[
'sequence' => '3',
'recipients' => array(
'signers' => array([
'email' => $this->issuerEmail,
'name' => $this->issuerName,
'recipientId' => '1',
'roleName' => $this->roleName,
'tabs' => $this->tabs,
])
)
]
),
'document' => array('documentId' => '3',
'name' => 'Attachment11',
'fileExtension' => get_file_extension_from_file($this->attachments['NIC_Rear']),
'width' => 100,
'height' => 100,
'documentBase64' => isset($this->attachments['NIC_Rear']) ? base64_encode($this->attachments['NIC_Rear']) : '',
),
]
);
}
This error you're getting:
{ "errorCode": "UNABLE_TO_CONVERT_DOCUMENT", "message": "System was unable to convert this document to a PDF. Unab (truncated...)
is indicative of any situation where the bits being passed to the DocuSign system cannot be converted into a flat pdf file representing the document.
It could be that it's not any document format that is supported, the document is password locked, empty or have any invalid macros or other bad stuff in it. Can you try a simple text document first just to isolate the issue?

Need help in configuring email alert in logstash 1.5.4

I was using logstash 1.4.2 and this email alert was working fine at that time. Now my system is upgraded to logstash 1.5.4 and logstash is failing because of older settings as below:
email {
from => "{{Mailfrom}}"
match => [ "ERROR ALERT", "LOGLEVEL,ERROR" ]
subject => "%{matchName}"
to => "{{Rcptto}}"
via => "smtp"
htmlbody => "<h2>%{matchName}</h2><br/><br/><div
align='center'>%{message}</div>"
options => [
"smtpIporHost", "{{smtpIporHost}}",
"port", "{{smtpPort}}",
"domain", "{{mailDomain}}",
"userName", "{{Mailfrom}}",
"password", "{{MailFromPassword}}",
"authenticationType", "plain",
"starttls", "true"
]
}
Now I am getting error as "You are using a deprecated config setting \"match\" set in email. Deprecated settings will continue to work, but are scheduled for removal from logstash in the future. If you have any questions about this, please visit the #logstash channel on freenode irc."
Can anyone help me here, as how should i configure it according to ERROR condition in 1.5.4?
Thanks in advance!
Correct configuration:
if ([LOGLEVEL] =~ /ERROR/) {
email {
from => "{{Mailfrom}}"
subject => "ERROR ALERT"
to => "{{Rcptto}}"
via => "smtp"
htmlbody => "<h2>ERROR ALERT</h2><br/><br/><div align='center'>%{message}</div>"
options => [
"smtpIporHost", "{{smtpIporHost}}",
"port", "{{smtpPort}}",
"domain", "{{mailDomain}}",
"userName", "{{Mailfrom}}",
"password", "{{MailFromPassword}}",
"authenticationType", "plain",
"starttls", "true"
]
}
}
Explanation:
According to the deprecated documentation of logstash output email the syntax of match => is:
{ "match name", "field.in.event,value.expected, , operand(and/or),field.in.event,value.expected, , or...", "match name", "..." }
In your given example the field is LOGLEVEL and the expected value is ERROR.
From the new documentation of logstash output email:
This setting is deprecated in favor of Logstash’s "conditionals"
feature If you were using this setting previously, please use
conditionals instead.
The corresponding conditional that checks if field LOGLEVEL contains ERROR:
if ([LOGLEVEL] =~ /ERROR/) { }

Setting the recipient email address dynamically

I am trying to integrate docusign api into my application using rest.I have used Request signature on document function form docusign APIWalkthrough.You can also refer the link http://iodocs.docusign.com/APIWalkthrough/requestSignatureFromDocument. I am trying to add the recipient address into the email field.but i am getting an error like the following.
/accountId = 657326 baseUrl = https://demo.docusign.net/restapi/v2/accounts/657326 error calling webservice, status is:400 error text is --> { "errorCode": "INVALID_USERNAME_FOR_RECIPIENT", "message": "The user name for the recipient is invalid. The user name is invalid for recipient email somangshu.drocker#gmail.com" }/
The code for the above method is as follows.
$email=VA_Logic_Session::getInstanceform()->emailaddress1;(this value is passed dynamically or to say its specified by the user)
$data = array (
"emailSubject" => "Sample Document",
"documents" => array( array( "documentId" => "1", "name" => $documentName)),
"recipients" => array( "signers" => array(
array( "email" => $email,(this variable is declared above with recipient email address spcified by te user)
"name" => $recipientName,
"recipientId" => "1",
"tabs" => array(
"signHereTabs" => array(
array( "xPosition" => "515",
"yPosition" => "279",
"documentId" => "1",
"pageNumber" => "2" )
))
))
),
"status" => "sent"
);
Also how do i point to the last page of any pdf. I could find the tab "pagenumber" as shown above. But what is the parameter to be passed there.
i am not able to figure out the problem hear.pls help
Whenever you receive the error INVALID_USERNAME_FOR_RECIPIENT check the actual values that are being set for the recipient's name. From our comments it seems that was indeed the problem in this case.
With regards to your page number question, there's no "last page" property so you need to know how many pages are in your document before you create the envelope to be able to assign to the last page. For instance, if you determine the document has 10 pages, then set to last page by doing:
"pageNumber": "10",
in your request body JSON (or XML).

Resources