I am trying to get data using GDC portal api. As it is shown in GDC API, to send an HTTP GET request, we need to have a format similar to:
https://api.gdc.cancer.gov/files?filters=%7B%22op%22%3A%22and%22%2C%22content%22%3A%5B%7B%22op%22%3A%22in%22%2C%22content%22%3A%7B%22field%22%3A%22cases.submitter_id%22%2C%22value%22%3A%5B%22TCGA-CK-4948%22%2C%22TCGA-D1-A17N%22%2C%22TCGA-4V-A9QX%22%2C%22TCGA-4V-A9QM%22%5D%7D%7D%2C%7B%22op%22%3A%22%3D%22%2C%22content%22%3A%7B%22field%22%3A%22files.data_type%22%2C%22value%22%3A%22Gene%20Expression%20Quantification%22%7D%7D%5D%7D&format=tsv&fields=file_id,file_name,cases.submitter_id,cases.case_id,data_category,data_type,cases.samples.tumor_descriptor,cases.samples.tissue_type,cases.samples.sample_type,cases.samples.submitter_id,cases.samples.sample_id,analysis.workflow_type,cases.project.project_id,cases.samples.portions.analytes.aliquots.aliquot_id,cases.samples.portions.analytes.aliquots.submitter_id&size=1000
Which is a format from json payload as:
{
"filters":{
"op":"and",
"content":[
{
"op":"in",
"content":{
"field":"cases.submitter_id",
"value":[
"TCGA-CK-4948",
"TCGA-D1-A17N",
"TCGA-4V-A9QX",
"TCGA-4V-A9QM"
]
}
},
{
"op":"=",
"content":{
"field":"files.data_type",
"value":"Gene Expression Quantification"
}
}
]
},
"format":"tsv",
"fields":"file_id,file_name,cases.submitter_id,cases.case_id,data_category,data_type,cases.samples.tumor_descriptor,cases.samples.tissue_type,cases.samples.sample_type,cases.samples.submitter_id,cases.samples.sample_id,analysis.workflow_type,cases.project.project_id,cases.samples.portions.analytes.aliquots.aliquot_id,cases.samples.portions.analytes.aliquots.submitter_id",
"size":"1000"
}
I wanna add more fields to the payload json and get the equivalent http query string format. I have tried some online convertors, like: JSON-to-String Convertor. Copying the above JSON gives me the below result:
"{\"filters\":{\"op\":\"and\",\"content\":[{\"op\":\"in\",\"content\":{\"field\":\"cases.submitter_id\",\"value\":[\"TCGA-CK-4948\",\"TCGA-D1-A17N\",\"TCGA-4V-A9QX\",\"TCGA-4V-A9QM\"]}},{\"op\":\"=\",\"content\":{\"field\":\"files.data_type\",\"value\":\"Gene Expression Quantification\"}}]},\"format\":\"tsv\",\"fields\":\"file_id,file_name,cases.submitter_id,cases.case_id,data_category,data_type,cases.samples.tumor_descriptor,cases.samples.tissue_type,cases.samples.sample_type,cases.samples.submitter_id,cases.samples.sample_id,analysis.workflow_type,cases.project.project_id,cases.samples.portions.analytes.aliquots.aliquot_id,cases.samples.portions.analytes.aliquots.submitter_id\",\"size\":\"1000\"}"
So, I tried to get data using the generated string by adding
https://api.gdc.cancer.gov/files?
to the beginning of that. But, running this, gives me a different output. So, how can I convert the JSON to exactly what is given in GDC website? Sorry, I am very new to API and their usages.
how to check only one value is accepted when the request is inserted? if both values are passes then send the error message using json. Either RegNumber or Pan should be accepted. i am very new to this
{
"email_id": "sample#example.com",
"RegNumber": "AM47",
"FromDate": 062020,
"ToDate": 062022,
"SchemaCode": 560043,
"PAN": "ABC44X"
}
I think you meant by get error in json response means app should return Json when it crashes, so to do, we must use middlewares and when you expect some error in response override that response error with your own custom json dict with error details.
When performing a GET Request on my Webhook (after triggering it) it returns the following response:
{
"id": "09292225-474a-408f-ab9d-ea2bc66e7fc4",
"request_id": "5f71ac28-98ff-4a01-b542-74ef3b21b700",
"attempt": "5f71ac28-98ff-4a01-b542-74ef3b21b700",
"status": "success"
}
but as I understand, it should be returning the JSON informations of the triggering event (like name, email, username ...)
What am I doing wrong?
This is the correct response - it's Zapier informing you that your webhook was received. Since task execution happens asynchronously on Zapier, further info cannot be returned about the result of the webhook.
I have a SoapUI REST (i.e. non-SOAP) mock service that returns a response for a POST request.
The request and response both contain JSON content.
At the moment, I can get it to return a static response and that works fine, but I want some of the values in the response to be dynamically sourced from the request.
So if I have this request:
{
"the_request":{
"abc":"123",
}
How can I get the value of "abc" copied in the response?
Investigation has lead me to believe I can do this via including a variable in the response, something like:
Response:
{
"the_response":{
"value_from_request":"${#MockResponse#Request#the_request#abc}",
"other":"stuff",
}
And then implementing a script to populate the variable in the response, via the Script tab.
How can I then populate this with data from the request?
Currently SoapUI just generates an empty value
"value_from_request":"",
Tried using mockRequest.requestContent in the Script tab, but have not found how to obtain the "123" value from it.
OK, worked this out. So the response message can simply reference a variable in the requestContext like so:
Response:
{
"the_response":{
"value_from_request":"${the_value}",
"other":"stuff",
}
And a groovy script can be used to parse the JSON request content and populate "the_value" or whatever you like in the requestContext:
// Parse the JSON request.
def requestBody = new groovy.json.JsonSlurper().parseText(mockRequest.getRequestContent())
// Set up "the_value" from the request message.
requestContext.the_value = requestBody.the_request.abc
// Bit of logging so can see this in the "script log" tab.
log.info "Value extracted from request: ${requestContext.the_value}"
I think the script should be like this
def requestBody = new groovy.json.JsonSlurper().parseText(mockRequest.getRequestContent())
context.setProperty("the_value",requestBody.the_request.abc)
I have a REST service which I am testing with SoapUI. The first step in my TestSuite returns the following Response (Json):
{
"mtMessageId": 52003685,
"status":
{
"value": 0,
"code": "OK",
"text": "Text message submitted"
},
"custMessageId": 123,
"custMessageRef": null
}
I want to 'Transfer' the value from the mtMessageId into the HTTP Get Request in the next step.
The request is formatted like "/SMS/{id}"
How do I transfer the value into the Request?
First of all you have to set the resource of your get method in your request with a property for example using /SMS/${#TestCase#id} in order to retrieve it from the first request.
Then add a groovy script testStep between your requests. An use the follow code to get the id from the json response of the first request and set as a property for the second request.
import groovy.json.*
// get the response from the first request using its name
def response = context.expand('${Request 1#Response}')
// parse it
def json = new JsonSlurper().parseText(response)
log.info json.mtMessageId
// get the json value an set it as property in testCase
context.testCase.setPropertyValue("id",json.mtMessageId.toString())
Note that you can use property transfer testStep to get the value from your request and set it as a property, however since SOAPUI converts all to xml I prefer to use a groovy script to work json.
Hope it helps,