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
Related
I'm trying to use Azure Data Factory to connect to QuickBooks Online General Ledger using OAUTH2. My approach is to first create a pipeline with a Web Activity to perform a POST call to receive the authentication token, then create a Copy Activity to read a JSON returned from QuickBooks. My approach is based on this blog. from Alex Volok Consultancy.
I have been unable to use the Web Activity successfully. I am unsure of the parameters and how to configure the Web Activity but have tried many different combinations trying to get this to work.
My desired result is to get QuickBooks Online data into Azure, is this the correct approach?
If this is not the best approach, what is?
If this is the correct approach, the attached screenshot shows my attempt at creating the Web Activity parameters to retrieve the authentication token that is currently not working. Any help is appreciated.
Please follow the below approach. It will solve your problem.
Sample URL : http://restapi.adequateshop.com/api/authaccount/login
Postman:
Using Postman, I generated a bearer Token for testing.
I used the same URL with web Activity and generated a bearer Token in the Azure data factory.
Use Your User id and Password as Body.
Output:
For more information refer this SO Thread and Blog by Ashok Patel
I'm looking at the Logic Apps Yammer connector.
When we put a message on Yammer we want to find out who has read it. Is there a way to find a list of people in a Yammer group who have not read a Yammer message?
If it can't be done in Logic Apps, is there another way to do it?
As a workaround, I'm trying to do this on the basis of who has liked a message and have done this in Logic apps. It gives a message that the response is not in JSON format. Also, it gives me the number of likes rather than a list of people who have liked it.
This is what I put into the HTTP request
After our chat I tried this
and this
and got this error message.
"error": "invalid_request",
"error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: d41c78c7-afa5-405f-8f52-8b587ecf1a00\r\nCorrelation ID: 9ffd2247-78ca-4be2-8111-c17a95a830d6\r\nTimestamp: 2020-01-23 10:09:55Z",
"error_codes": [
900144
]
I also tried putting in my Azure directory id in place of tenant id. It failed with and without the directory id.
It seems there isn't an action in logic app Yammer connector which can get the list of users in a group who haven't read a message. And I checked all of the rest api in Yammer api document. Just find a rest api which can get the users in a group:
https://www.yammer.com/api/v1/users/in_group/:Group_Id.json
So I think neither yammer rest api nor logic app can not implement this requirement of get the list of users in a group who haven't read a message.
Update:
For your question about how to implement the workaround in logic app, as I don't have yammer app and account, so I can just provide some suggestions for your reference.
Since the yammer actions in logic app are very limited, so we can just use yammer Apis in logic according to HTTP action.
First we need to get access token from yammer, you can refer to this tutorial and refer to the C. App Authentication title in it. Put this post url in HTTP action in logic app and get the response body. Parse the response body and get the token property under the access_token property. Then we can use this token in the apis which we will call in the next HTTP actions.
Then, call this api in HTTP action(choose "Get" as the method) with the token which we got above to get the users who like the message, the url should be like this:
https://www.yammer.com/api/v1/users/liked_message/:Message_id.json?access_token=<<ACCESSTOKEN>>
Get the response body(and parse it in json type in array) from the api above and then call the other api in HTTP action(with access token) to get the users in one group. Also get the response body from it and parse it in json type and store in array.
After that, use two nested "For each" actions in logic app to loop the two array and compare them. Then we can get the result which you want.
Update 2:
I am working with CosmosDB and fetching data, which has a few tokenized fields due to security. The obvious way to handle this is to make a query, get the data from CosmosDB and then de-tokenize it using a REST API.
But I am trying to check if there is a way where in we can use a UDF in Azure CosmosDB and make a REST API call from the UDF Javascript, which so far I am unable to do. If this is possible, I only call the query (with the UDF) and I get de-tokenized data back.
** The de-tokenize process has to happen through a REST API call to external party.
Any help or experience will be appreciated.
Thanks
This is not possible with a UDF or any server-side capability in Cosmos. The security implications for this is why it's not allowed/possible.
You'll need to read the data into your app, then make the REST call before passing down to the user.
Thanks.
MS Dynamics 365 has exposed two REST APIs in order to get to the data. The first API is an URL that returns a token. I need to dynamically pass the token as header to the second REST API and pull the actual data. Can we use Logic Apps or Azure data factory to accomplish this? If yes, can you please provide the steps to accomplish this? Any help will be much appreciated. Thanks in advance.
Logic Apps has a native connector to the D365 Common Data Service, and it can be triggered using a REST call, so it could in effect replace the need for the native REST API, but it would not be my first choice because it will add some overhead (delay) to your round-trip depending on whether the Logic App has been used lately.
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