We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Return is formatted as urlencoded

Questions and answers about Plum Fuse+

Moderators: admin, support

Post Reply
thomas.carroll
Posts: 9
Joined: Tue May 09, 2017 11:14 am

Return is formatted as urlencoded

Post by thomas.carroll »

the return we are receiving is not in a format that is supported by default. Do you have any recommendations to pull information from it? i am using the itmgrs log in.

below is an example of a return we are receiving.

UMversion=2.9&UMstatus=Approved&UMauthCode=018000&UMrefNum=1544346229&UMavsResult=No%20AVS%20response%20%28Typically%20no%20AVS%20data%20sent%20or%20swiped%20transaction%29&UMavsResultCode=0&UMcvv2Result=Match&UMcvv2ResultCode=M&UMresult=A&UMvpasResultCode=&UMerror=Approved&UMerrorcode=00000&UMcustnum=&UMbatch=76&UMbatchRefNum=45567481&UMisDuplicate=N&UMconvertedAmount=&UMconvertedAmountCurrency=840&UMconversionRate=&UMcustReceiptResult=No%20Receipt%20Sent&UMprocRefNum=387138680300913&UMcardLevelResult=B%20&UMauthAmount=&UMfiller=filled

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: Return is formatted as urlencoded

Post by support »

For the REST module, we support the following return types: JSON, CSV, XML, TEXT, or EMPTY

We advise you reformat your webservice return to be more easily parseable by Fuse+, the easiest being JSON.

anorman728
Posts: 15
Joined: Wed May 10, 2017 12:07 pm

Re: Return is formatted as urlencoded

Post by anorman728 »

I came across a similar issue with a service that I don't actually have any control over. JSON is definitely best, if possible, but, if not, I got around this by setting the return type to TEXT and using this JS function to extract the values:

Code: Select all

function parseUrl(inputUrl)
​{
​    var returnJson = {};
​    var urlArray = inputUrl.split('&');
​    var len = urlArray.length;
​    for (var i = 0; i < len; i++) {
​        dumArr = urlArray[i].split('=');
​        returnJson[dumArr[0]] = decodeURIComponent(dumArr[1]);
​    }
​    return returnJson;
​}
Run the values returned through parseUrl using the (+) button in the lower-right corner of the module (in the same module in which the function is defined) and you'll be able to set values using the same (+) button. A little bit of a pain (because editing JS in the module is a little difficult), but it does the job.

Post Reply