How to extraxt "id" from every page of the JSON? (Note:- path - Json>>data>>page_size>> ID(which i need to extract) - operating-system

'''
How to extraxt "id" from every page of the JSON? (Note:- path - Json>>data>>page_size>> ID(which i need to extract)
'''

Related

How to send an email with query output result as attachment from Data Factory?

I have a data into the SSMS table that I need to send it as an email attachment using data factory. any suggestion to set up a pipeline such way so I can query the data from the table and attach that output and send it in the email would be appreciate.
I tried using logic APP to send an email , I am able to send an email but I was not able to find out the way I can attach the query output data as an attachment in that email , 1st have a lookup activity to get the data from the table then I have used web activity to set the trigger to send an email. inside the web activity I have used Logic app URL , post as method ,
BODY : { "message" : "#{activity(Lookup1').output}", "DatafactoryName" : "#{pipeline().DataFactory}", "pipelineName" : "#{pipeline().PipelineName}","receiver" : "#{variables('receiver')}"
I have declare variable called receiver to store email ids.
To send an Output of lookup activity as an attachment follow the below procedure:
In logic app For the Send Email (V2) action, customize how you wish to format the email, using the properties and to add attachment select Attachment from Add new parameter dropdown give Attachment name you want and add Attachment Content as message from Dynamic content.
For the Body, enter the following JSON:
{
"message" : "#{string(activity('Lookup1').output.value)}",
"dataFactoryName" : "#{pipeline().DataFactory}",
"pipelineName" : "#{pipeline().Pipeline}" ,
"receiver" : "#{pipeline().parameters.receiver}"
}
Output:

How to get My SharedPreference stored string in non Class file in dart?

I have constants.dart file and it contain all constant file including base url of my REST API. I need to change my REST API URL based on selected city which is already stored in shared preferences. I've attached my Code below.
Here is the Code

Mongodb shell find to filter and extract embedded text data

I would like to find and extract details from a "stringified" api call which is a field in mongo db document.
The field is like "apiData" field below (only in one long line) which contains both request Headers and a Response Body
as an embedded object - I've separated it out on lines to make it easier to read.
The keys and values are inside "escaped" quotes
a) Can I filter/find based on a selection of header and Response body information
Currently, I'm using a regex e.g. apiData : /5684830/
Is there anything better?
b) extract a selection of header and Response body information from the field string in Mongo by
using build functionality or some else in the mongodb shell v4
Currently, I am exporting the entire field and then processing it.
I was hoping there might be a better way within the mongodb shell.
e.g Example of extract fields/end result
{
"Status Code" : "200 OK"
"numFound\": "56047",
"ebook_count_i": 14,
}
Example of document
{
_id : ObjectId("0000000000000000000000000")
apiData : {
\"Request URL\": \"http://api-call-eg.org/search.json?q=1984\"
\"Request Method\": \"GET\"
\"Status Code\": \"200 OK\"
\"Response Body\" :
{
\"numFound\": \"56047\",
\"start\": \"0\",
\"docs\": [
{
\"cover_i\": \"5684830\",
\"ebook_count_i\": 14,
\"author_name\": [ \"Rand McNally\"],
}
}
}
}
Can I filter/find based on a selection of header and Response body information
Currently, I'm using a regex e.g. apiData : /5684830/
The way you use regex is the perfect solution for the way you have stored your data
extract a selection of header and Response body information from the field string in Mongo by using build functionality or some else in the mongodb shell v4
Unfortunately, you have string. So it's the only option.
But if you can store them as field:value in mongo, you can make use of beautiful aggregation framework where you can do many queries in time efficient manner.

How to download file from bottle + pymongo?

How do I download files from my gridFS store in Mongodb?
I have the following code:
#bottle.route('/download')
def download():
file_id = ObjectId(bottle.request.query.id)
if file_id:
try:
file_to_download = fs.get(file_id)
except:
return "document id not found for id:" + file_id, sys.exc_info()[0]
return (file_to_download)
return bottle.template('files_test/download')
which returns gibberish in the browser. How do I specify that I want it to be downloaded?
Edit:
This is the hyperlink I want to use to download the file:
&lt--Download File--&gt
Have I missed it here well?
See this question:
flask return image created from database
You need to set the Content-Type and Content-Disposition headers so the browser knows what type of file you're sending, and that it should be downloaded rather than displayed.

SoapUI Pro : Transfering a XML node from a TestCase to another

When using the Property Transfert window to transfert a XML node (with children nodes) taken from the response of a first Soap request to a second Soap request, and that both requests are in the same TestCase, it works great :
TestCase 1 :
Source : [First Soap Request] Property : [Response]
declare namespace ns='http://xxx.com';
//ns:xxxxx[1]/ns:return[1]
-------------------------------------------
Target : [Second Soap Request] Property : [Request]
declare namespace ser='http://xxx.com';
//ser:xxxxx[1]/ser:someobject[1]
But if the two requests are in different TestCases, I guess it is required to save the XML node to a TestSuite property first, and then transfert this property to the new Soap request :
TestCase 1 :
Source : [First Soap Request] Property : [Response]
declare namespace ns='http://xxx.com';
//ns:xxxxx[1]/ns:return[1]
-------------------------------------------
Target : [TestSuite1] Property : [myVariableToTransfert]
TestCase 2 :
Source : [TestSuite1] Property : [myVariableToTransfert]
-------------------------------------------
Target : [Second Soap Request] Property : [Request]
declare namespace ser='http://xxx.com';
//ser:xxxxx[1]/ser:someobject[1]
This doesn't work!
It seems I'm unable to get valid XML in the second request when it is taken from the TestSuite as a property. Sometimes the value is null, sometimes it is wrapped in CDATA tags or the XML is entitized ("<" are "&lt", for example). I'm unable to get the value as real XML, like when both requests are in the same TestCase!
I played with the "Transfert Text Content", "Entitize tranfererred value(s)" and "Transfert Child Nodes" options but without success!
How can I tranfert a XML node from a request in a TestCase to a request in a second TestCase?
Set your response value as custom property at test suite and then you can use this for further testing..remember it will save your value as string data so if you are saving your integer data then you have to covert it into integer before further use.Like
testRunner.testCase.testSuite.getPropertyValue("").toInteger()
Here is the detailed explanation:
Create test suite 1 and the below steps
test case 1
DataGen step
test case 2
Within the DataGen step, open the editor, add new property via clicking on "+" button and select script as Type (you should also give a name to the property now assume the name is yourprop).
At the below side of the screen you should see the script editor. And create a script as below (please notie that you should change the variables according to your web service and XML)
def testXML = context.expand( '${Test Request#Response#declare namespace ns1=\'http://namespace/'; //ns1:WebServiceNameResponse[1]/ns1:nodeName[1]}' )
Now you have created a soapUI property via DataGen named yourprop. You can use this property within the test suite for the following test cases.
I hope this helps, if you are not satisfied or you face any problem please let me know I will do my best.