How to pass CSV or XML data as Body Parameters to API Post operation using API Management Action in Logic App? - azure

This is in relation to the question : -
How can I pass Body Parameters to API Post operation using API Management Action in Logic App?
Now I am able to pass JSON through the body of my logic app.
I would like to pass CSV or XML data as Body Parameters to API Post operation using API Management Action in Logic App.
Currently, the APIM accepts JSON sample only.
I am able to pass CSV or XML data using postman without any issues. Please find the attached pictures for details of this issue.
Thanks,
Paul

As I mentioned in comments, the solution is:
Add representation with "CONTENT TYPE" as text/csv and leave the "SAMPLE" and "DEFINITION" box empty like below screenshot:
And then in your logic app, request the api like this:

Related

Azure ADF Web Activity Form data

I am using Web Activity to get the response from an API. The API takes a Csv file as its body parameter along with some string. I tried using this link How can i pass file as parameter in post request (Web Activity) Azure Data Factory? but could not succeed, I was getting the below error
The other help says to use logic apps for this , has anyone tried using web activity for posting form-data.

Response from `InvokeRESTAPI` on my Azure pipeline

My InvokeRESTAPI displays the following if executed:
I can see a Response field printed that is empty.
Can I somehow use this to get a value back from the API reply and use it to call another template with it?
On the task itself I am using this parameter:
successCriteria: eq(root["status"], "successful")
So I would assume that if there is some custom success criterion then I would be able to use a value from the response in order to define it.
Based on your screenshot, you are using the API to post the json content to Azure Logic App workflow.
So you need to add the Response Action in Azure Logic App to add response content to the work flow.
Here are the steps:
In Logic App:
Then when you run the API in Invoke Rest API task, it will show the customer response.
For more detailed info, you could refer to this doc: Construct the response

Get Records from Salesforce using Azure Logic Apps

I am trying to use Azure Logic Apps to read data from one of the Salesforce objects which has huge number of records. The Salesforce connector fetches the record and returns the pagination link as #odata.nextLink. But when I try to use a JSON parser to read the value it’s coming as null.
I tried to access the nextlink in a browser but it requires authentication. What authentication do we pass here ?
I would like to use an until action to iterate till I get a next link . So how do I check the condition for the until loop ?
nextLink doesn't look like core Salesforce thing, it might be the OData connector preprocessing the results for you. You'd have to consult the documentation for the connector (if any).
Salesforce's REST API will return field with nextRecordsUrl if there's next page of results, you'd call that in loop until the field disappears. You'd call it like any other REST API resource available after login, by passing Authorization: Bearer <sessionId also known as accessToken here>. Again - probably the connector abstracts this away from you. Don't think you can send headers like that in browser, you'd need curl, Postman, SoapUI or similar http client.
If you don't get better answer and documentation is scarce - consider using raw REST API. Or Azure Data Factory has an almost-decent Salesforce connector?
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm

custom input & output fields for azure function

I am not sure if this is an option. I require it badly, and cannot find any references of it.
When integrating between an HTTP Triggered Azure Function within your Logic App flow, you are requested to pass a body object for the function to digest:
I am hoping for a way to customize the Request Body inputs, to make it have a strict template structure, in and out.
In:
Out:
(The function returns an Object)
Is there any way I can achieve this?
You could create a Logic Apps Custom Connector.
You can create one of these from a Postman collection or using an OpenAPI definition. You can get hold of the OpenAPI definition from the Function App.
With a custom connector, you have a bit more control over the request and response. This will allow the users of your connector to provide inputs when used in a Logic App and also receive tokens from the response. These can then be used in further Logic App steps.
Just hard coded it to the fields I require it using the Logic App syntax and it responds to satisfaction
#{body('function-name')?['property']}
Haven't tried the Custom Connector

Azure Logic App - Simple Email Template for JSON Request Body

I've got a simple Azure Logic App, which receives and emails out JSON data in a very basic HTML table format (created with a convertToTableAction).
Does anyone know of a way to instead send this out using an email template?
I've got a SendGrid account set up with my Azure subscription, but there doesn't seem to be any way to specify a template id with the Send email (v2) action in Logic apps.
I can't quite see how I'd edit the Logic App code to use the only SendGrid api that seems to support sending templates V3 either. (It is my first Logic app though, so I could well be missing a trick)
Really, any advice on how to send out a templated email would be appreciated.
As you mentioned that the logic app integrate the Sendgrid(V2) currently. You could give your feedback to Azure team.
If azure function is acceptable, you could add and run custom code for logic apps through Azure Functions
there is two way to do it ..
1) Using SendGrid Connector :
You need to create one azure function or web API pass request as your JSON outout string and replace with html content and get html in response
Pass html response in body of the send email action of SendGrid Connector
Details of SendGrid Connector
Please refer this link for Json data replaced to html
my explanation is very short but if you don't understand then i will help you in details

Resources