My requirement is to accept xml data file that may be gziped in HTTPS POST request and request may be chunked.
Request body WILL have the type of application/.xml.
I am using Postman to make request and java spring to write the controller and rest of the api code.
My questions is how will my request will look like, either it will be form data with xml file in input or raw body with xml selected in postman.
I am finding it hard to make a curl for it.
Here is the example request requirement:
Related
Question: How do you make an HTTP POST request to an external service within Exist DB, ideally using just XQuery?
Motivation: I want to take a set of XML documents in Exist DB, and send each to an external server for processing, then I want to receive the result, and store them back in Exist DB.
I can accomplish this with an external script that interacts with the Exist DB REST interface, but I would like to it all within Exist DB and XQuery. Marklogic has a http request function that does POST requests under the xdmp namespace, which seems to accomplish this. Does something similar exist for Exist-DB?
Bonus points if the request body can be sent in JSON format.
eXist-db implements the EXPath HTTP Client specification, which defines a function, http:send-request, that can perform HTTP POST requests.
For sample code, including sending a request body containing JSON, see eXist-db send JSON via POST request using eXPath Http_module.
When I was trying in browser to send a GET request with data from bootstrap datatable ajax to a C# MVC controller method, not all the data that was send was mapped to the model object. Some properties in the model object still remained with null/default value.
I verified the property names and no issues in that. But when I did the same thing in postman app the data was successfully bound to the model object.
Two things that I noted in the postman app is that:
The request data is not send in the query string parameter rather in
the request body with still the method type as GET (I don't know
how that is possible), but in browser as usual the data was URL
encoded and was sent as query string parameter.
In post man app the request headers also contains "Content-Type"
header with "application/json" as value.
So I also tried with "Content-Type" header with "application/json" but still no use the data was not bound.
Finally I chose the common way, I just set the "Content-Type" header with "application/json", stringified the data with JSON.stringify and I set the type as "POST" and it successfully got mapped.
What I got struggling is, how does the postman app alone can send a GET request like that with data in the request body.
If anyone has idea about this please tell me that would help me to have an idea about the HTTP requests.
1.) PostMan - GET Request Format
2.) PostMan - Get Request Network Data
3.) PostMan - Get Request Network Data - Raw Format
4.) Backend - Contoller Received Data
1.) Browser - GET Request Format
2.) Browser - Query String Parameters
3.) Backend - Contoller Received Data
I'm trying to pull data from a post API that expects authentication and request parameters as part of the request body. I guess, what they do is access the data from the post variables.
What I have seen so far in documentation is how to send POST via JSON or headers. In my case, no headers just the post body parameters.
call to this api via curl --data option works just fine.
curl --data "username=xyz&password=xyz&function=xyz" http://example.com/api.php
How can I replicate above call in nifi?
I have tried multiple methods without success. Latest has been Generate flow file, update attributes (where i fill in the parameters), invoke http then putfile.
But I'm getting errors - the api is not abe to authenticate my request.
Thanks
If you need to send the following data in body, then put it into content of your flowfile.
username=xyz&password=xyz&function=xyz
The easiest way to put it into the Custom Text property of the GenerateFlowFile processor.
Usually for this kind of body you have to provide content type header:
content-type: application/x-www-form-urlencoded
If you don't need any additional headers then you don't have to define any additional attributes of the flow file.
IN magento, as I am using REST api to get the product details with url like http://myserver.com/magento/api/rest/products? But this url returns only in XML format. But I need it in the JSON format.
Can anyone suggest me how to get it in JSON format without using REST client??
you need to set request header explicitly to application/json then the response is served in json.
I have an application for load testing. I am using JMeter for this purpose. I have added CSV Data Set Config to the While Controller where former reads URL from a csv file. Also, I have added a HTTP request sampler inside the controller.
Now, I have both get and post requests . In addition to that, I have to send file data with few http post requests. Is there a way so that jmeter can decide http request type automatically and create a request accordingly?
Should I create separate While Controller for both GET and POST requests?
You could add method field (post,get) and use an
IfController to eithet call a post or get depending on method value.
See:
http://jmeter.apache.org/usermanual/component_reference.html#If_Controller