Dynamically add text/data to a DocuSign template - c#

I'm implementing an API that is written in C# using ASP.NET Web API. The implementation of our API calls out to DocuSign e.g. in order to request signatures for contracts. Our application interacts with DocuSign through its REST API.
I would like to be able to create a template for our contract document and then simply reference this template when sending the contract via the REST API.
The issue I have is that the contract document needs to include data that is queried from our database, e.g. a list of products that are specific to a recipient.
Is it possible to add placeholders in the template that can then be replaced, via the REST API, with recipient-specific text/data that is queried from a database?

Yes this is easy to do through the API. Let's say you want to get a person's name and SSN and have a template that has two data fields in it called ApplicantName and ApplicantSSN. By referring to the tabLabel of each you can dynamically set their values, so for instance:
{
"accountId": "221765",
"emailSubject": "DocuSign API Example",
"templateId": "44D9E888-3D86-4186-8EE9-7071BC87A0DA",
"templateRoles": [
{
"email": "sally.doe#email.com",
"name": "Sally Doe",
"roleName": "RoleOne",
"tabs": {
"textTabs": [
{
"tabLabel": "ApplicantName",
"value": "John Doe"
},
{
"tabLabel": "ApplicantSSN",
"value": "12-345-6789"
}
]
}
}
],
"status": "sent"
}
Just make sure you exactly match the name you set in the UI with the tabLabel you set through the API call.

Related

Microsoft Graph API - not able to use orderby or filter on createdDateTime for Sites

I want to query Sites using Microsoft Graph API that were created after a certain time. So I created the following filter query:
createdDateTime ge 2023-01-01T00:00:00Z
I also tried:
createdDateTime ge `2023-01-01T00:00:00Z`
Both generated an invalid request error with no details.
I then tried just doing an orderby createdDateTime. This did "work" but it sorted each page, not the whole dataset. So page 2 had items that should have been in page 1 and so on.
Microsoft Graph API seems really crappy. Does anybody know how to achieve this? Any help would be greatly appreciated.
I've never found a way how to use filter on /sites endpoint.
I'm using /search/query endpoint for searching SharePoint sites based on some criterion.
You should be able to specify filter by Created and properties for sorting.
POST https://graph.microsoft.com/v1.0/search/query
{
"requests": [
{
"entityTypes": [
"site"
],
"query": {
"queryString": "Created > 2022-01-01 AND Created < 2022-12-31"
},
"from": 0,
"size": 25,
"sortProperties": [
{
"name": "Created",
"isDescending": "false"
}
]
}
]
}

Exact Permissions\actions needed to List Azure Resources using C# rest API

I am trying to list all resources in a Subscription using Rest API Call.
https://management.azure.com/subscriptions/{SubscriptionID}/resources?api-version=2021-04-01
It works fine when I run it with Built-In RBAC Role Reader Permissions. For security reasons, I wanted to avoid having read access to entire scope of subscription. So, I need to create a Custom Role with specific permissions\actions to list all Resources in a Subscription.
I am trying with below Custom Role but not able to get any response from Rest API call.
{
"properties": {
"roleName": "AzResourceTest",
"description": "To test the exact ACLs needed to get Resources List from a Subscription",
"assignableScopes": [
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
],
"permissions": [
{
"actions": [
"Microsoft.Resources/resources/read"
],
"notActions": [],
"dataActions": [],
"notDataActions": []
}
]
}
}
Can someone please suggest what should I use in actions to get resources.
Got it. "Microsoft.Resources/subscriptions/resources/read" is the action for Custom Role to list resources in a subscription

Power BI Embedded - Parameters

I am currently using the "App Owns Data" Web app to embed my reports,
Is it currently possible to pass parameters to the report before its loaded? I know you can pass filters but this is not sufficient for what i want to achieve.
Ideally i would like to be able to pass a parameter to my web app, then this gets passed into the report which changes the source and database name of the data being shown.
This would save having to create a new report for each system, providing we use the same SQL schema.
Any Information on this would be much appreciated.
You can use the "Set parameters" API for this:
https://msdn.microsoft.com/en-us/library/mt845781.aspx
POST https://api.powerbi.com/v1.0/myorg/groups/{group_id}/datasets/{dataset_id}/UpdateParameters
{
"updateDetails": [
{
"name": "MaxId",
"newValue": "5678"
},
{
"name": "StrParam",
"newValue": "Another Hello"
}
]
}

DocuSign API Metadata in envelope

Using the C# SDK for requesting signatures to remote recipients. Was wondering if I could add metadata to the envelope itself, e.g. another id specific to our domain, that can be set once (initially) and be retrieved anytime regardless of document status. I'm seeing the EnvelopeDocument.DocumentFields as a potential, but not sure if this is proper for what I'm doing. Also seeing EnvelopeDefinition.CustomFields.*. Tried to use TextCustomFields but I don't see this displayed on the document (when show=true), let alone if this is attached to the envelope throughout it's lifecycle. Any help would be appreciated. Thanks!
When you create a DocuSign Envelope, you can specify custom metadata either at the Document-level or at the Envelope-level (by using "custom fields").
Document-level custom fields get associated with a specific document within an Envelope.
Envelope-level custom fields get associated with the Envelope itself.
Metadata that's specified using custom fields (regardless of whether at the Document-level or Envelope-level) will not be visible to Envelope recipients, but can be subsequently retrieved via API at any time.
Based on the information you've provided, it sounds like you're most likely interested in Envelope custom fields. I don't have much experience using the DocuSign C# SDK, but here's the JSON portion of a Create Envelope request that specifies a single custom field at the Envelope-level:
{
"emailSubject": "Please Print, Complete and Sign Document",
"emailBlurb": "Please print and complete documents and sign on paper. ",
"status": "sent",
"compositeTemplates": [{
"inlineTemplates": [{
"sequence": "1",
"customFields": {
"textCustomFields": [{
"name": "MyOwnField",
"required": "true",
"show": "true",
"value": "MyValue"
}]
},
"recipients": {
"signers": [{
"requireSignOnPaper": "true",
"name": "John Doe",
"email": "jdoe#test.com",
"recipientId": "1",
"routingOrder": "1"
}]
}
}],
"document": {
"documentId": "1",
"name": "AccountApplication.pdf",
"transformPdfFields": false
}
}]
}
Based on this, if you're seeing EnvelopeDefinition.CustomFields.TextCustomFields in the C# SDK, I'd suspect that's what you'll use to create an Envelope Custom Field. As I mentioned earlier, recipients won't see the Envelope Custom Field value(s) in the DocuSign web UI, but you should be able to subsequently retrieve the Envelope Custom Field value(s) via API at any point in the Envelope lifecycle.
Update (C# code sample):
Based on a brief look at the C# SDK, here's a code sample that shows how to create two (text) custom fields on an Envelope:
// create a new envelope which we will use to send the signature request
EnvelopeDefinition envDef = new EnvelopeDefinition();
// create my first Envelope custom field
TextCustomField myFirstCustomField = new TextCustomField();
myFirstCustomField.Name = "field1";
myFirstCustomField.Value = "value1";
// create my second Envelope custom field
TextCustomField mySecondCustomField = new TextCustomField();
mySecondCustomField.Name = "field2";
mySecondCustomField.Value = "value2";
// add my custom fields to the envelope
envDef.CustomFields.TextCustomFields.Add(myFirstCustomField);
envDef.CustomFields.TextCustomFields.Add(mySecondCustomField);
...

PayPal Rest API - Update Billing Plan Return URL

I have been using the PayPal Rest API and have successfully created and activated a BillingPlan but I'm having trouble updating said plan's return_url. I think it's something to do with the JSON path I'm using although I'm not sure why!?
Anyway, I am calling the update plan method: https://developer.paypal.com/docs/api/#update-a-plan
A BillingPlan follows the format:
{
"id": "P-94458432VR012762KRWBZEUA",
"state": "ACTIVE",
"name": "T-Shirt of the Month Club Plan",
"description": "Template creation.",
"type": "FIXED",
...
"merchant_preferences": {
"setup_fee": {
"currency": "USD",
"value": "1"
},
"max_fail_attempts": "0",
"return_url": "http://example.com",
"cancel_url": "http://example.com",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE"
},
...
}
I'm using the C# SDK but my request JSON should look very much like:
{
"path": "merchant_preferences",
"value": {
"return_url": "http://example.com/payment/return"
},
"op": "replace"
}
I keep getting responses along the line's of:
{"name":"BUSINESS_VALIDATION_ERROR","details":[{"field":"validation_error","issue":"Invalid
Path provided."}],"message":"Validation
Error.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#BUSINESS_VALIDATION_ERROR","debug_id":"2ae68f9f0aa72"}
To sum up - I want to change the billing plan return_url from http://example.com to http://example.com/payment/return.
I've changed the path to various things to no avail. Can anyone help??
You cannot update the plan, once it is set to active. The reason for that restriction is that because there could be possible agreements based on that plan, modifying it would affect the already agreed billing agreements.
However, I agree with your problem statement, that changing the Return URL should not be an issue as this is not a part of agreement, but more of a configuration change. It would be nice to somehow allow updating similar settings in Plan, even after active. I will let the API team know about that.
however, in the mean time, there is no way you would be able to do that. Alternatively, you could possibly create a new plan, and use that instead. Not the answer you are looking for, but a probable solution.

Categories