I created a logic app which gets the data from restapi. The content type of data is Application/protobuf(protobuf is a binary data made by google https://developers.google.com/protocol-buffers/docs/tutorials) I know that LA uses base64 encoding so it changes the data to base64 encoding. As the data to be deserialised via protoc complier so it needed binary format. So i store this data into a variable and trying to paas this further processing. But unfortunately the data stores in variable changes into boxes and ? So protoc compiler fails to deserialised the same.
I tried base64tobinary and http() as per suggestion mentioned section "other content type" on microsoft https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-content-type#applicationxml-and-applica...
But it did not work. Can anybody help on this?
I tried reproducing the issue and found that the rest API body which we are receiving will be transformed back to string when we use string() i.e.. string(triggerBody()) dynamic expression.
Later, I convert to binary by using the dynamic expression 'binary', i.e. 'binary(outputs('Compose')', which will return a 'application/octet-stream' result. When I tried to convert back to a string, everything worked great for me.
Here is the flow of my logic app
and here is the output
I have changed the way of using. Instead of streaming, I am storing the data into file and processing further.
Related
I am attempting to send a POST request to my API from my React app and am figuring out how to change a CSV from input to JSON format so no downloading needs to take place. I have seen people use Papaparse but from what I saw was that it hadn't been updated in a while so I am looking for other options.
const handleSubmit = async (event) => {
event.preventDefault();// from elements property
console.log(event.target.returns.value)
console.log(await axios.post('http://127.0.0.1:5000/ratios', event.target.returns.value))
setShow(true)
};
If I just send like this I get a 500 error and the first line of my POST function on Flask is
df = request.get_json()
maybe there's an easier way but let me know if you have any insight or advice. Thank you in advance
Your question is somewhat confusing and I think it's due to your understanding of how csv and json would interact. CSV is essentially a way to send tables of data, it doesn't have an inherent key pair structure so you need to do a little work to convert it. I'm not familiar with flask specifically but it looks like df = request.get_json() is trying to parse what it expects to be json but is instead csv. You are right that you need to convert that. Papaparse seems like an excellent option and is still under active development. However I don't think that really matters since csv and json are formats that haven't changed in a long time so the task of converting them hasn't changed. So whether or not there has been recent development doesn't matter.
If you decided to roll your own you could probably get close by taking each row and turning that into an object then matching each row entry with a first row key label or just with saved constants. Depend on how your csvs are structured.
I'm testing an application that calls one API, gets a bunch of work orders, then only the work order ID's are passed to another API to display on the page.
The format they need to be in is: {"workOrderIds":["12345","123456"]}
I'm using the JSON Extractor with the following Path Expressions:
$..workOrderNumber
then I'm using the JSR223 PostProcessor and using the following script:
props.put("workOrderNumber", "${workOrderNumber}";
The problem is, that its creating the object like so when I add the variable into the POST Request body of the second request:
{"workOrderIds":["12345, 123456"]}
essentially, I just need to make sure that each value has quotations, but not sure how to make this happen. Sorry if this seems simple, I'm fairly new to QA and have spent several hours trying to figure this out.
We cannot provide a comprehensive answer without seeing the source JSON, maybe it worth trying explicitly casting the filtering result to an Integer like:
vars.put('workOrderIds', new groovy.json.JsonBuilder(new groovy.json.JsonSlurper().parse(prev.getResponseData()).findResults { entry -> entry.workOrderNumber as int }).toPrettyString())
More information:
Apache Groovy - Parsing and producing JSON
Apache Groovy - Why and How You Should Use It
After testing URL in the google structured data testing tool, I don't know why the question mark character is shown instead of utf-8 characters?
what is wrong? any help really appreciated.
the url is : link
and the result image:
The underlying json is:
don't know why, but the structured data tool doesn't understand your farsi. If farsi is an encoded javascript, like \u0645\u0648\u0633\u0633\u0647 - there is no problem. But if it is written like علائم تیروئید کم کار - something wired happens.
Fast and dirty solution: encode all of your structured data content as encoded javascript. In Notepad++ this makes a plugin named HTML Tag - then ctrl+j.
I am trying to use the API to return data from the Chagrin Falls station in Ohio. I can get the data from the website so I know there is data, but the API does not return any values.
I have a valid token and the examples in the documentation work, but if I try any to alter the examples in any way I get nothing back just any empty json object {}.
Example I am trying to use:
https://www.ncdc.noaa.gov/cdo-web/api/v2/data?datasetid=GSOM&stationid=GHCND:US1OHGG0014&units=standard&startdate=2020-08-01&enddate=2020-08-01&limit=1000
Data from the website:
https://www.ncdc.noaa.gov/cdo-web/datasets/GHCND/stations/GHCND:US1OHGG0014/detail
I don't exactly know how you are going to achieve this since you haven't told us what programming language you are using. However, with python I use a module called urllib to extract raw html data from a url that can be seen from the browser using ctrl+u.
I am writing a simple migration tool in which I have to migrate gmail mailboxes to some other email provider. I am confused about raw string returned from gmail api.
In Google document, it says:
"raw": Returns the entire email message content in the raw field as a URL-safe base64 encoded string and the payload field is not used. This includes the identifiers, labels, metadata, MIME structure, and small body parts (typically less than 2KB).
So this means "raw" returns only small body parts less than 2kb and if the body parts are more than 2KB, there will be a problem. I have checked with some dummy emails containing email body(including inline attachments) more than 2KB, and it still works. It still returns the complete body without any problem. Sorry,if I missed something, please clear my confusion. If "raw" is working fine for all email body sizes , I will be using this approach in my project instead of "full" query parameter.
best regards,
messages.get(format=RAW) returns the entire email always. That document: https://developers.google.com/gmail/api/v1/reference/users/messages/get is incorrect and needs to be fixed.