How to send params in platform.api.get


#1

I am using platform.api.get access a Remote Web Service, which works fine.
The remote web-service is basically a simple PHP script which I use to send notifications.

I need to send the message and device token to the webservice as parameter, so I was wondering how to do that.

If I put the entire external URL in the get( ), I send it as query string with the URL, which works fine. But, I was interested to know how to send the params when using the remote webservice, which I can set in the DSP.


#2

The below does NOT give me device and message in the php file.
var result = platform.api.get(“iosnotification”,{“device”:“64049f56abe454a1ab0ab0bac00673d659a50***0f0c2b6289a7f0",“message”:“Hello and Hi”});
OR
var payload = {“device”:"64049f56abe454a1ab0ab0b
927ea10f0c2b6289a7f0”,“message”:“Hello and Hi”};
var result = platform.api.get(“iosnotification”,JSON.stringify(payload));

Whereas, the one below with external URL does:-
var result= platform.api.get(“http://ec2-54---23.ap-southeast-1.compute.amazonaws.com/bitnami/simplepush.php?device=64049f56abe454a1ab0a**********5437927ea10f0c2b6289a7f0&message=Hellos+We+ALL+Are+HEre”);

I access them in PHP Script like this:-
deviceToken=_GET[“device”];
message = _GET[“message”];


#3

No inputs by the DF team even after 11 days have passed.
Is it that even for a response on the forum one needs a support plan?

Please let me know if this forum as well is linked to your support plan… because most of my queries are unanswered.


#4

@praveen Please let me know what support case number you opened with us, and I will get you an update ASAP!


#5

I have not opened any support case.
I have only asked this question here in this forum. This question is what I am referring to.


#6

Then perhaps no one in the forum community has done what you’re trying to do, so no one here has replied with their advice.

As for sending a token along with a remote web service call, is the Add More Parameters functionality not sufficient for your needs?

The above would send ?device=64049f56abe454a1ab0a**********5437927ea10f0c2b6289a7f0 appended to the remote web service call.


#7

I can always try by adding a key value pair as mentioned in the picture above.
However, the value I am sending is a variable, not constant.

So, are the values mentioned above just defaults, and the actuals are the ones I can send from the call to platform.api.get( ) ?


#8

We have identified that this functionality is not currently present, and are evaluating ways to add it as an enhancement to the next release. You’re correct that “Add More Parameters” is only valid for constant values.


#9

Just wondering if this functionality has been added. I have a similar requirement.


#10

Yes. This has been resolved. This post was actually in reference to a previous version of the product. Scripting in DF 2.0 supports URL parameters.


#11

Thank you @drewpearce. Any pointers to an example would be very helpful.


#12

var result = platform.api.get('https://api.twitter.com?twitter_api_key_parameter=somevalue');


#13

Thank you @drewpearce