How to get dynamic template data from sendgrid api - sendgrid

I'm using Sendgrid API to get the list of all dynamic templates. I was a bit surprised when I saw that the API response doesn't contain any info about the dynamic template data.
Is there a way to get the dynamic template data from sendgrid API ?
example: my dynamic template contains this dynamic data:
{{ firstNameĀ }}
{{ lastNameĀ }}
{{ linkĀ }}
And I want to get this data back when querying sendgrid API:
[GET] https://api.sendgrid.com/v3/templates/{{templateID}}
Thanks for your time !

The solution is to use the URL provided in the Sendgrid Docs but with a special query parameter ?generations=dynamic
Thus the final URL would look like this:
https://api.sendgrid.com/v3/templates?generations=dynamic
Very happy to find this, since I was also looking for it a long time.

Related

Azure Data Factory Webhook body problems

So I'm experiencing some issues in Azure Data Factory.
I have a standard pipeline where I'm trying to implement a webhook for later callbacks, but the body for the webhook post does not seem to be behaving.
(In advance: sorry for the image URLs -> I'm not reputable enough to post images)
So here is what I've typed into the "Body" of the Webhook service: https://imagizer.imageshack.com/img922/3765/ApbiRN.jpg
Then I verify that the template looks correct:
https://imagizer.imageshack.com/img924/5448/vN82Vp.jpg
And finally I debug the pipeline only to find this as output from the webhook: https://imagizer.imageshack.com/img923/3697/AEDzOT.jpg
As you can see it's grabbing a {"Key":"Value"} from somewhere.
Now I've saved the pipeline; I've published the pipeline; I've restarted ADF.. Still.
So the first issue is that I'm not able to send the body that I want.
The second issue is that I'd like to parameterize the body (when this is cleared up):
{
"key1":"#{pipeline().parameters.param1}",
"key2":"#{pipeline().parameters.param2}",
"key3":"#{pipeline().parameters.param3}"
}
I've not been able to solve that last one either, so if any kind souls would be so kind.. much obliged!
Edit: In addition I've not been able to spot the "callBackUri" that the documentation promises: https://learn.microsoft.com/en-us/azure/data-factory/control-flow-webhook-activity
Any insights into that issue as well?
I tried many times and finally succeeded.
In your case, you can use the expression as follow:
#json(concat(concat('{"key1":"',pipeline().parameters.param1,'",'),concat('"key2":"',pipeline().parameters.param2,'",'),concat('"key3":"',pipeline().parameters.param3,'"}')))
The result is as follow:
First, we need to concatenate the query string.
Then we need to use #json() to convert the string type to json type.

Cannot pass value to SalesForce from Docusign Document, SOAP API, MergeFieldXml

Good day everyone,
I need to pass the value of a write-back field from docusign document to Salesforce.
Can you kindly provide an example of a string specifying the properties of MergeFieldXml like configuration type, path, etc.
According to Docusign SOAP API (https://www.docusign.net/api/3.0/dsapi.asmx?op=RequestEnvelopeWithDocumentFields) the MergeField property is passed as string:
<MergeFieldXml>string</MergeFieldXml>
At the same time the string should contain properties like:
Configuration type: salesforce (always)
path: objetc.field
row: record id
writeback: true if the data should be posted to salesforce.
My try does not work showing 'Web service callout failed: WebService returned a SOAP Fault: A Mergefield value for a Tab could not be retrieved. faultcode=soap:Client faultactor=missing in Web.Config
Row Number: 1196'
tab19.MergeFieldXml = '<configurationType>salesforce</configurationType><path>contact.Question_1_Agreement__c</path><writeback>true</writeback><allowSenderToEdit>false</allowSenderToEdit>';
If using REST API this would look as follows:
"mergeField": {
"configurationType":"Salesforce",
"path":"contact.Question_1_Agreement__c",
"writeback":"true",
"allowSenderToEdit":"true",
}
According to SOAP API documentation (https://www.docusign.com/p/APIGuide/APIGuide.htm#Sending Group/Tab.htm%3FTocPath%3DDocuSign%2520Service%2520API%2520Information%7CSending%2520Function%2520Group%7CCreateAndSendEnvelope%2520and%2520CreateEnvelope%7CTab%7C_____0)
MergeFieldXml is 'reserved for future'.
Does it mean it is not implemented yet?
how do we pass values back to salesforce using SOAP MergeFieldXml?
Or there may be some other way to accomplish this?
Thank you for any advise.

How to restrict returned Wordpress REST-API fields when using WP-API Node Module

If I call this Wordpress blog url in a browser
<root...>wp-json/wp/v2/posts?per_page=5&fields=id,link,title
I get back JSON and the result is restricted to 3 fields
So how can I do this when using the node js wp-api module?
I would like something similar to .fields([]) but there is nothing in the docs, can find nothing in the module code.
TypeError: wpapi.posts(...).perPage(...).fields is not a function
Or something like .filter({})
TypeError: wpapi.posts(...).perPage(...).filter is not a function
But I think this might be connected with another Wordpress plugin that's required.
wpapi.posts()
.perPage(5)
.fields(['id','link','title'])
.search( 'search-term' ) //= (search in title or content)
.filter({
category_name: 'islands',
fields: [ 'id','link','title' ]
})
.get(function (err, data) {
..... etc.
TypeError: wpapi.posts(...).perPage(...).fields is not a function
Can anyone point me in the right direction? Thanks
It appears wp-api node module does not allow this.
So I uninstalled it and am now using axios along with standard text urls.
This worked for me:
wpapi.posts().param('_fields', 'id,title,content').get()
The node-wpapi documentation seems to suggest say that perPage() and functions like it are convenience functions that call param(props, value).
wpapi.posts().param('_fields', ['id','title','content']).get()
also seems to work but the first option gives a resulting request url that looks more like the format the Wordpress REST API Handbook uses

Node-RED and REST APIs with resource id's

I'm trying to use Node-RED to develop a REST based API. For example, a GET would be:
http://myurl.com/widgets/"widget-id"
where "widget-id" would be 123. I can get this to work using query strings. However, I can't seem to figure out what to put on the http input node to allow a resource id to get passed. Am I missing something obvious? Any ideas on what I need to do?
The other answer is nearly right, it just needs tweaking for Node-RED
If you set the URL in the HTTP Input node to /widget/:id
you can access the widget id in a function node linked to the HTTP Input node as follows:
var id = msg.req.params.id;
if you get all widgets:
router.get('/widgets/', function(data){});
if only one item(for example - 123):
router.get('/widgets/:id(\\d+)', function(data){});
in you're browser or if you using POSTMAN enter http url: http://youredomain.com/widgets/or http://youredomain.com/widgets/123

Why does one HTTP GET request retrieve the required data and another retrieve []

I'm currently working on ng-admin.
I'm having a problem retrieving user data from my REST API (connected to a MongoDB) and displaying it.
I have identified the problem as the following:
When I enter http://localhost:3000/users into my browser, I get a list of all users in my database.
When I enter http://localhost:3000/users?_page=1&_perPage=30&_sortDir=DESC&_sortField=id,
I get [] as a result.
I am quite new to this, I used both my browser and the POSTMAN Chrome extension to test this and get the same result.
http://localhost:3000/users_end=30&_order=DESC&_sort=id&_start=0
This (/users_end) is a different request than /users.
It should be:
http://localhost:3000/users?end=30&_order=DESC&_sort=id&_start=0
Or, by looking at the other parameters:
http://localhost:3000/users?_end=30&_order=DESC&_sort=id&_start=0
with end or _end being the first parameter (mark the ?).
Update (it is ? and before the _, I have edited.):
If adding parameters to the request returns an empty list, try adding only one at a time to narrow down the problem (there's probably an error in the usage of those parameters - are you sure you need those underscores?).
Your REST API must have a way to handle pagination, sorting, and filtering. But ng-admin cannot determine exactly how, because REST is a style and not a standard. So ng-admin makes assumptions about how your API does that by default, that's why it adds these _end and _sort query parameters.
In order to transform these parameters into those that your API understands, you'll have to add an interceptor. This is all thoroughly explained in the ng-admin documentation: http://ng-admin-book.marmelab.com/doc/API-mapping.html