Get parameter from a given URL (not the calling) in Logic App - azure-logic-apps

I have an URI as a string which I get out of a Json in my Logic App.
How can I access any of the query items of the uri?
Inside the For Each which loops through the uri string list, i tried the following expression to get the query parameter filename, but it did not work:
items('For_each_2')['queries']['filename']
This returns 'The template language expression 'items('For_each_2')['queries']['filename']' cannot be evaluated because property 'queries' cannot be selected'.

There is a URI parsing functions in logic app to query property from URI, suppose you want is uriQuery, however it returns the whole after ?. It will be like below.
And if you want to query a specific property, you should pass them with the logic app trigger URL. It provides triggerOutputs()['queries'] property to get the queries, and this will return a json object, it will allow you to query specific parameter.
This is a sample:
https://xyz.logic.azure.com:443/workflows/id/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=code&test=123&test2=345
Then should be able to use triggerOutputs()['queries']['test'] to query.

Related

How to store object on URL query string

I am developing a generic search component on React that puts it's filters, current page and some other params on the URL query string (after the ?).
I currently use the URLSearchParams to transform the query string to js objects and back to query string, as the react-router-v4 expects
The point is that I need to store an Object within the query string, so I can differentiate the search filter (that can have multiple fields) from other params.
I see that I can transform a object to JSON, and store everything on a filter param, or I could store the object using dot notation (?filter.name=foo&filter.tag=bar) or even a square brackets notation (?filter[name]=foo&filter[tag]=bar) and treat them accordingly when reading them from the url.
I am tending to choose the JSON notation, but Is there any problems with this approach? Should I know beforehand any limitations? Is there a better way to do it?

How to stop $location.url from auto decoding query

I am using following query "/search/queryText=at%26t/results" to redirect to a page.
The location url auto decodes it to "/search/queryText=at&t/results". I need the value to be pristine, so that I can make use of $location.search to create an object of parameters.
The $location.search treats & as delimiter and creates two parameters (queryText=at and t=true)rather than one for the above example. Is there a way to handle this?

Support for query parameters in Dart for Google Endpoints?

I have a Dart application that's getting data from a custom Google endpoint. I'm using discoveryapis_generator to generate the client library. I would like to issue a query like the following:
import endpoints_api.dart as EndpointsApi;
api = new EndpointsApi.MyApi();
api.photos.list(api.Photo.post_id == "post1");
endpoints_api.dart is the client library generated by discoveryapis_generator generate.dart. MyApi is my custom endpoints API, and photos is one of its services. I think Photo is an endpoints model class which has an instance property post_id.
Issuing the request results in an error to the effect that Photo has no static getter "post_id". This is close to how to the syntax of a query in the Python API, so it was the only way I could think of to specify it here.
I don't know what else might be helpful in describing my request. Hopefully it is self-evident. There's an active enhancement described here, but it seems to refer to limiting the fields, rather than items, in the response.
Update:
Poking around in the client library, I found the source for the list methods. It certainly looks like query parameters are supported. But it seems to me that it's not entirely correct. The formal parameter list contains the query parameters specified in the API surrounded by braces:
async.Future<PhotoCollection> list({core.String postId, core.String regionId}) {...
But in the method body, there's the following:
if (regionId != null) {
_queryParams["region_id"] = [regionId];
Are the brackets in [regionId] to extract region from the parameter list?
I pulled the braces out of the parameter list. Since I only ever expect to query by postId, that's the only parameter:
async.Future<PhotoCollection> list(core.String postId) {...
Voila. I can now add a parameter to the query by just specifying its value in the call:
api.photos.list("post1");
If you wrap the parameters of a method in curly braces, you make them optional.
So you can still use your method with the given signature. You just have to add the name of the parameter you want to pass:
api.photos.list(postId: "post1");

How can I bind a directive to a column cell in angular-ui-grid?

First, this is what I'm trying to do: I am using ngResource to grab an array of data from an API and setting the ui-grid's data to the array. One of the columns is an ID that has no meaning to the user. I would like to use another API to look up the meaning of that ID and get the human-friendly result of that. Before using ui-grid, I was simply using a directive that took that ID and set the element's text as the return result from the secondary API.
I know that it's possible to bind a column dynamically to data in that row's object, having looked at: http://ui-grid.info/docs/#/tutorial/106_binding, but it appears that this is limited to binding to the data in $scope or in the grid's data (such as in the example). I also see that there is a cellClass options method which allows conditional setting of the cell's class. However, I do not see any good options for intercepting the element in the cell and replacing it with a result of my choosing.
I am wondering what the best way to do this is. I've tried using ngResource's transformResponse but the array is too large to make a blocking event. As well, I've tried to inject the html for the directive into the field's return function, i.e. field: transformToHtml() but only the raw string shows, not the rendered html.

ng-repeat convert resource objects to simple objects

Iam getting my data with help of the Angular's $resource service as array. Each element of that array is an Resource-Object. So i can use methods like $save and $update of these Objects. In a view i represent my array with the help of the ng-repeat directive like:
<div ng-repeat="appointment in object.appointments" ng-click="editAppointment(appointment)">
And here i get in trouble. The appointment-Object i get in the editAppointment-Method is a simple Object. No Resource Object anymore. So i cant use the helpfull methods like i mentioned above.
$scope.editAppointment= function(appointment){
console.log(appointment); // > Object
console.log(object.appointments); // > Array of Resource
}
Have somebody noticed that problem too? May its a bug, but i cant imagine that.
Assuming your resource class is called Appointment, you should just be able to do:
$scope.editAppointment= function(appointment){
new Appointment(appointment).save();
}
Presumably your Appointment resource looks something like the following (i.e. it correctly maps some sort of id property from existing objects to the URL parameters):
var Appointment = $resource('/appointment/:appointmentId', {appointmentId:'#id'});
This would be the case if your appointment objects (i.e. the underlying JSON objects handled by your API) have an ID property called id. If it's called something else (or if there are multiple path variables in your URL) you'll just need to change the second argument to map all of the properties of the objects being saved (the values starting with '#') to the URL path variables (the things starting with ':' in your URL).
See where they save a new card in the credit card example here: http://docs.angularjs.org/api/ngResource.$resource. The fact that they're dealing with a totally new object and that you're trying to save an existing one is irrelevant. Angular doesn't know the difference.

Resources