What type of format is this API response? - api

I am using an API that gives me response in this format :
{'captchaId': '11655487', 'code': '644SD843ADSH48678 (just some letters and numbers)'}
Looks like JSON but it uses different quotes.
Does anyone know what format is it??

Related

How to convert date (1991-08-23T00:00:00) which is captured in response and then convert this format (08-23-1991) in vugen?

I am working on a script where I need to submit a form and do some authentication during the steps. I am using LoadRunner Vugen for scripting. For one of the request's response I can see birthdate is coming like below:
"suffixName": ""
"birthDate": "1991-08-23T00:00:00",
"agencyName": ""
In another later request I can see in jason body the same date is used like below
"Body={\agentSuffix":null,"agentFirstName":"XYZ","agentLastName":"WSD","agentBirthDate":"08-23-1991" and so on with additional body.
I am able to capture the date from response by using web_reg_save_param_ex. But now how do I convert the value so that I can use it in next jason body in a custom request. I just need help to capture it.
Captured value: 1991-08-23T00:00:00
Expected value: 08/23/1991
Thanks in advance
Correlate for the string
Use your programming skills in the language of your virtual user to transform transform the string into a new string. Your test code might be C, JavaScript, Java, ... so use language-appropriate string conversion functions.
Hints
"LB=birthDate":"", "RB=T00:00:00"
Conside the loop and what this means for the use of substring and sprintf();
for (counter=0;counter<=strlen(lr_eval_string(MyCorrelatedVarName));counter++)
{ lr_message("%s",&lr_eval_string(MyCorrelatedVarName)[counter]); }

Big Query - extract json field which contains emoji?

In my BQ database table I have a column called payload which contains raw facebook webhooks JSON payloads as string. One of them contains a text with an emoji like Sample 🏦. In big query it look like
{"object":"page","entry":[{"id":"xxxx","time":1602757469275,"messaging":[{"sender":{"id":"xxxx"},"recipient":{"id":"xxxx"},"timestamp":1602757469062,"message":{"mid":"m_xxxx","text":"Sample \ud83c\udfe6","quick_reply":{"payload":"{\"key\": \"value\"}"},"tags":{"source":"source"}}}]}]}
I would like to create a view with a column text with extracted text field value from the raw json. I created an sql like
SELECT
JSON_EXTRACT_SCALAR(payload, '$.entry[0].messaging[0].message.text') as text,
FROM `my_table.facebook.webhook_received`
Sadly the result I get looks like that Sample ��
Does anyone know how to make big query decode the emoji properly or at least just not change it to those � signs ?
Those characters you have embedded are not for a bank icon which is your issue I believe.
Run the following in BQ and it returns the desired emoji:
select " Sample \U0001f3e6"
Ref:https://emojipedia.org/bank/
The two you have provided seem to default to the '?', invalid character
http://unicode.scarfboy.com/?s=U%2Bdfe6
edit: what ever is handling the message maybe throwing the encodings you're seeing in your message which may be the actual problem.
If you are using BigQuery Python client and its load_table_from_json method, there is a Unicode bug (especially its byte is over 0xFFFF, like 🏦) in the previous version, and I have submitted this bug fix which is already included in the latest release include it, https://github.com/googleapis/python-bigquery/releases/tag/v2.24.0. By the way, you should use \U0001F3E6, not \ud83c\udfe6 (UTF-16 hex type) to present 🏦 in your Python code with BigQuery.
Unicode Character 'BANK': https://www.fileformat.info/info/unicode/char/1f3e6/index.htm,
https://charbase.com/1f3e6-unicode-bank

What should i use to parse and unparse data like : "a:66:{s:24:"images";a:0:{} s:26:"thumbnail_image";s:0:"";:"... ?

I'm working with ThemeFuse I found this data format. But it not looks like anything I saw before.
a:66:{s:24:"autotrader_slider_images";a:0:{}s:26:"autotrader_thumbnail_image";s:0:"";s:19:"seek_property_price";s:0:"";s:23:"seek_property_vat_price";s:0:"";s:21:"seek_property_mileage";s:0:"";s:25:"seek_property_engine_size";s:0:"";s:30:"seek_property_engine_power_bhp";s:0:"";s:29:"seek_property_engine_power_kw";s:0:"";s:23:"seek_property_reduction";s:1:"0";s:25:"seek_property_consumption";s:1:"0";s:20:"seek_property_origin";s:0:"";s:22:"seek_property_emission";s:13:"super emitivo";s:23:"autotrader_vehicle_type";s:3:"SUV";s:20:"autotrader_fuel_type";s:6:"Diesel";s:23:"autotrader_gearbox_type";s:9:"Automatic";s:17:"autotrader_status";s:6:"Intact";s:16:"autotrader_color";s:5:"White";s:18:"seek_property_year";s:0:"";s:26:"autotrader_enable_comments";s:5:"false";s:29:"autotrader_enable_breadcrumbs";s:4:"true";s:25:"autotrader_header_element";s:4:"none";s:23:"autotrader_header_image";s:0:"";s:23:"autotrader_header_title";s:0:"";s:24:"autotrader_select_slider";s:2:"-1";s:19:"autotrader_page_map";s:0:"";s:19:"autotrader_map_text";s:11:"We are here";s:19:"autotrader_map_zoom";s:2:"13";s:25:"autotrader_search_element";s:4:"none";s:22:"autotrader_content_top";s:0:"";s:26:"autotrader_content_bottom1";s:0:"";s:25:"autotrader_footer_element";s:4:"none";s:31:"autotrader_select_slider_footer";s:2:"-1";s:25:"autotrader_content_bottom";s:0:"";s:26:"autotrader_content_bottom2";s:0:"";s:23:"autotrader_top_ad_space";s:5:"false";s:23:"autotrader_top_ad_image";s:0:"";s:21:"autotrader_top_ad_url";s:0:"";s:25:"autotrader_top_ad_adsense";s:0:"";s:30:"autotrader_bfcontent_ads_space";s:5:"false";s:25:"autotrader_bfcontent_type";s:5:"image";s:27:"autotrader_bfcontent_number";s:3:"one";s:31:"autotrader_bfcontent_ads_image1";s:0:"";s:29:"autotrader_bfcontent_ads_url1";s:0:"";s:33:"autotrader_bfcontent_ads_adsense1";s:0:"";s:31:"autotrader_bfcontent_ads_image2";s:0:"";s:29:"autotrader_bfcontent_ads_url2";s:0:"";s:33:"autotrader_bfcontent_ads_adsense2";s:0:"";s:31:"autotrader_bfcontent_ads_image3";s:0:"";s:29:"autotrader_bfcontent_ads_url3";s:0:"";s:33:"autotrader_bfcontent_ads_adsense3";s:0:"";s:31:"autotrader_bfcontent_ads_image4";s:0:"";s:29:"autotrader_bfcontent_ads_url4";s:0:"";s:33:"autotrader_bfcontent_ads_adsense4";s:0:"";s:31:"autotrader_bfcontent_ads_image5";s:0:"";s:29:"autotrader_bfcontent_ads_url5";s:0:"";s:33:"autotrader_bfcontent_ads_adsense5";s:0:"";s:31:"autotrader_bfcontent_ads_image6";s:0:"";s:29:"autotrader_bfcontent_ads_url6";s:0:"";s:33:"autotrader_bfcontent_ads_adsense6";s:0:"";s:31:"autotrader_bfcontent_ads_image7";s:0:"";s:29:"autotrader_bfcontent_ads_url7";s:0:"";s:33:"autotrader_bfcontent_ads_adsense7";s:0:"";s:21:"autotrader_hook_space";s:5:"false";s:21:"autotrader_hook_image";s:0:"";s:19:"autotrader_hook_url";s:0:"";s:23:"autotrader_hook_adsense";s:0:"";}
What should I use to parse and unparse this format?
This is serialized PHP array.
All you need to do is to unserialize it.
http://php.net/manual/en/function.unserialize.php

AFNetworking invalid JSON format returned

I need to query the Yahoo stock query service in an iOS application using AFNetworking.
The query returns the following result;
YAHOO.Finance.SymbolSuggest.ssCallback({"ResultSet":{"Query":"yahoo","Result":[{"symbol":"YHOO","name":"Yahoo! Inc.","exch":"NMS","type":"S","exchDisp":"NASDAQ","typeDisp":"Equity"},{"symbol":"YHOF.EX","name":"YAHOO","exch":"EUX","type":"S","exchDisp":"EUREX Futures and Options Exchange ","typeDisp":"Equity"},{"symbol":"YOJ.BE","name":"YAHOO JAPAN","exch":"BER","type":"S","exchDisp":"Berlin","typeDisp":"Equity"},{"symbol":"YHOO.MX","name":"Yahoo! Inc.","exch":"MEX","type":"S","exchDisp":"Mexico","typeDisp":"Equity"},{"symbol":"YHO.DU","name":"YAHOO","exch":"DUS","type":"S","exchDisp":"Dusseldorf Stock Exchange ","typeDisp":"Equity"},{"symbol":"YAHOY","name":"Yahoo Japan Corporation","exch":"PNK","type":"S","exchDisp":"OTC Markets","typeDisp":"Equity"},{"symbol":"YAHOF","name":"Yahoo Japan Corporation","exch":"PNK","type":"S","exchDisp":"OTC Markets","typeDisp":"Equity"},{"symbol":"YOJ.SG","name":"YAHOO JAPAN","exch":"STU","type":"S","exchDisp":"Stuttgart","typeDisp":"Equity"},{"symbol":"YHOO.SW","name":"YAHOO","exch":"EBS","type":"S","exchDisp":"Swiss","typeDisp":"Equity"},{"symbol":"YHO.HM","name":"YAHOO","exch":"HAM","type":"S","exchDisp":"Hamburg","typeDisp":"Equity"}]}})
As the you can see, the JSON is not formatted properly. Specifically speaking, the YAHOO.Finance.SymbolSuggest.ssCallback() is not needed and causes the JSON formatter to crash.
Is there a way to tell AFNetworking to kind of skip the text that isn't part of the actual JSON?
Edit:
Upon #rckoenes request; This is how the webservice is used;
http://www.jarloo.com/yahoo-stock-symbol-lookup/
Well it looks like this is not a public API, so you might not be allowed to use it. Off course you still can. Just create your own response serializer end before you decode the JSON remove first part with seem simple string replace and remove the last charter. This should return valid JSON.

facebook api query string issue

I develop a facebook api with asp.net , I have to send query string but this querystring may include special characters like ( ı, ç ö, ş, ğ ). When I send query string with special characters, facebook returns me an error-
The URL http://apps.facebook.com/sportsfanarena/Results.aspx?s=13&co=3&ci=Bal%c4%b1kesir&g=0 is not valid.
The "ci" variable's value is "Balıkesir".
Is there any solution to handle it?
I believe you need to use URL encoding to send characters like that, though I may be mistaken.
Here is an online utility which will take text and encode/decode it in URL encoding.
Try encoding the word you are wanting to send using this utility, and then try your API request with the encoded text.