How to use JSON in OrientDB HTTP command request - orientdb

I'm using orientdb-community-2.2-alpha and I'm trying to use JSON payloads with the HTTP command API (as in calling http://<host>:<port>/command/<database>/sql) and I simply can't figure out how to do it. All I get is an OCommandExecutorNotFoundException saying Cannot find a command executor for the command request: sql.<whatever JSON I tried here> no matter what I try.
I'm not providing an example of what I've tried as I'm not trying to do any one specific thing; I would just like to see a working curl example of how to post a generic command request using a JSON payload.
I can use JSON with batch requests just fine, it's just the command API that I can't get to work.

You can try with Postman plugin

Related

Difference in the HTTP Response code is getting observed when executing a POST call from cURL vs Postman for the same negative test condition

Correct URI: https://example.com/a/b/users/111/c
Negative test URI: https://example.com/a/b/users/<111>/c
Sample Request Body:
{
"abc": "xyz"
}
Postman returned 404 with a message that the user doesn't exist, for the negative test URI mentioned above.
Then I executed the cURL generated by the Postman and appended to it "-k" to ignore the certificate verification and "-v" for verbosity. However, cURL returned 500 for the same URI.
The original concern was that there has been a mismatch in the test results when the above API was hit by an automation test using RestAssured vs when manually executing it from Postman. Debugging that has led me to find out the difference in response between Postman and curl as well.
Any thoughts to debug this issue further?
While debugging, I found the URI passed was getting encoded and decoded, and <111> got printed as %3C111%3E at one of the breakpoints. So when I tried sending the encoded URI from cURL like https://example.com/a/b/users/%3C111%3E/c it worked just fine returning 404. However Postman returned 404 both with <111> and %3C111%3E.
Thanks to #derpirscher for providing hints that helped me reach this conclusion.
P.S. For more details, please refer my last comment above.

How to start TensorFlow Serving ModelServer with the REST API endpoint

I'm trying to make use of the new possibility to send HTTP requests to the TensorFlow ModelServer. However, when I try to run the following, it doesn't recognize the --rest_api_port argument:
tensorflow_model_server --rest_api_port=8501 \
--model_name=half_plus_three \
--model_base_path=$(pwd)/serving/tensorflow_serving/servables/tensorflow/testdata/saved_model_half_plus_three/
unknown argument: --rest_api_port=8501
I've encountered the same error. I looked through the source code.
In main.cc file, there is no rest_api_port option in the source code version r1.7 below.
Due to this, if you want to use REST, you need to use tensorflow-serving r1.8 above or implement it your self.
Hope this is helpful to you.

Jmeter SOAP/ XML-RPC request default URL

I am trying to test web service for my project. The Web service accepts a SOAP request and gives appropriate response.
In JMeter I have chosen SOAP/ XML-RPC request. It works completely fine for me and gives me correct response. However, I have more than 100s of web services in my scope of testing and I have to test them in different environments. It is very cumbersome work to change the URL value from the SOAP/ XML-RPC sample to point it to different env. Do we have something like HTTP Request Default for SOAP/XML-RPC requests?
I have also tried a bean shell sampler where I am setting the value of a variable and then retrieve it in the SOAP sampler URL parameter. However it did not work for me. Below is the code.
Bean Shell sampler code:
vars.put("baseURL","http://localhost:9191/ws/soap");
SOAP/ XML-RPS Sampler URL value:
${__BeanShell(vars.get("baseURL"))}
Any suggestions? I read in JMeter docs that this can be done via http sampler, however, I want to avoid using the same if possible.
You should avoid using SOAP/XML-RPC in favor of pure Http Sampler.
Use the "Templates..." (menu) > Building a SOAP Webservice Test Plan:
This way you can use HTTP Request Default if you want.
But note from what you describe, using a CSV Data Set Config would allow you to variabilize the URL.
Use JMeter Properties to set base url like:
in user.properties file (under /bin folder of your JMeter installation) add one line per property:
baseURL=http://localhost:9191/ws/soap
alternatively you can pass the property via -J command line key as:
jmeter -JbaseURL=http://localhost:9191/ws/soap -n -t /path/to/your/testplan.jmx -l /path/to/results.jtl
Refer the defined property in your test plan using __P() function
${__P(baseURL,)}
You can even provide the default value, i.e. if the property is not set via user.properties file or command-line argument - default value will be used:
${__P(baseURL,http://localhost:9191/ws/soap)}
See Apache JMeter Properties Customization Guide for more information on JMeter properties and ways of setting, overriding and using them.

Unable to understand the cURL invocation

I am currently using jpmml openscoring REST API..
I have successfully installed Maven and built the uber-JAR file and I am also able to access
http://localhost:8080/OpenScoring/rules.pmml
I am confused with the instructions given at
https://github.com/jpmml/openscoring.
It says the sample curl invocation is
curl -X GET htttp://localhost:8080/openscoring/model
but I am getting a 404 error when I try to implement this. What does model mean here?
I am getting an output when I implement this:
curl -X GET htttp://localhost:8080/Openscoring/rules.pmml
The /model/ part of the path identifies the resource type. The general formula for the path component of Openscoring service URLs is /<context path>/<resource type>/<resource identifier>/<action>
In your case (assuming that the model identifier is rules.pmml), the correct path component would be /openscoring/model/rules.pmml.
I was getting a 404 error as I did not put my rules.pmml file in the directory which my command prompt pointed to.(This was a very silly mistake)
And thanks to the user Anik Islam Abhi in the comments, I found out what model in the invocation
curl -X GET htttp://localhost:8080/openscoring/model meant.
model is just an Endpoint of the REST source but not a directory in the openscoring folder or any kind of path.

How do you upload a image file and a json with curl?

I'm trying to use command line curl to test an API. The call takes in some parameters and a image file. Is there a way for me to specify the parameters using a json file, and make the request via curl so both the image file and the json file gets uploaded to the server?
Check the curl documentation here
In the POST (HTTP) part you'll find the answer to your question.
You need to use the -F parameter