Some doubts around certain requested URLs


Paolo Lops

Hi David,another ask for you . i must consume a webservice with a proproetary syntax (see bold words) (it is http://loopback.io/) but i think that there are some misunderstanding with your variables trancodification at runtime. can you help me?

[token] is a variable and it is correctly replaced at runtime.tanks paolo


DecSoft

Hello Paolo,

It's difficult to help without more details. For example, I am not quite sure if the "HttpSetHeader" is really needed. But anyway must work. On the other hand, about the URL that you try to conform, certainly I can see something "rare"

Maybe is a mistake when copy the URL and variables, but, this have not too much sense: [where][0][email]

Maybe you want to conform an URL like the below one?

That URL must work, in principle. Maybe you can use the EncodeURI action, but, I am not sure.

Finally, the point is, what is the result that you expect and what is the result that you get? Some error message?



Paolo Lops

according to the loopback manual

REST API

In the first form below, the condition is equivalence, that is, it tests whether property equals value. The second form below is for all other conditions.

For example, if there is a cars model with an odo property, the following query finds instances where the odo is greater than 5000:

For example, here is a query to find cars with odo is less than 30,000:

the sintax is rigth... i have sent you an email with the full http GET request. the result is a json object


DecSoft

Hello Paolo,

I am not quite sure about what the problem can be. Maybe you have an problem with the variables in the URL? Certainly, if we must place something like "[this]" in the URL, since "[this]" appear as an AB variable, maybe we can have some problem. Maybe a possible solution can be to use HTML entities instead of the brackets "as is".

I want to shown here the HTML entities, however, they are converted to the brackets... so I can't shown to you here as I wanted. But take the idea: instead of use the brackets "as is", you must replace the brackets with their HTML entity representation, so AB don't take it as variables.

If something like that don't work as expected, maybe you need to prepare some "bridge" between the API that you want to use and your app, using some server script placed in your app's server. So you can use URLs without the "brackets" (all of these suposing this is the problem, I am not sure!), and then your server script made the appropriate calls to the API (here we can use "brackets" without problems) and provide to the app the API response.

But I must insists, Paolo, I am not sure if the brackets are the problem or not. Do you get what you wanted? If not, do you get some error message?



Paolo Lops

i have foud the solution.. i can use json request insteed

how i can create a json string in ap?


DecSoft

Hello Paolo,

May something like the below can be enough:

In the Result variable you have an JSON string representation of MyObject.



Paolo Lops

a possible solution to my forst post is change [ with \x5b

 and ]  whit \x5d

in HttpSetUrl

 before call HttpExecute

David could be interesting implement this in ap ?

you do something simmilar with \x22  for "

thanks paolo


DecSoft

Hello Paolo,

I think that can understand what you wanted, however, I am not sure if something like that can be good. Commonly we can use variables, so, maybe it's not a good idea to replace the brackets in all the cases. Use brackets "as is" is probably more rare than use variables.

Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.