I am sort of new to lua and I have API that I need to call.
"https://status.abc.com/integrations/plus/?endpoint="..number.."&server="..server
This is not in a json format. It is just sending this http string to a web server. What is the simplest way to acomplish this?
local ok =os.execute([[curl --cert /etc/openvpn/cert.crt --key /etc/openvpn/key.key -X POST -H 'Content-Type: application/x-www-form-urlencoded' 'url here' --data 'data here']])
Try looking into the LuaSec library.
There is no https support native to lua so your (as far as i know) only option is to build LuaSec or try to find a build on the internet
Related
I have submitted a request for google Audio to text. I received the name back, but I am unsure how to add private key info from file downloaded to:
curl -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
"https://speech.googleapis.com/v1/operations/your-operation-name"
and then am I able to run the command from web or Mac?
You can set up the environment variable to use the private key as mentioned here. Though the link talks about Vision API, the process is similar to use Cloud Speech-to-Text API. Also, here is additional documentation for authentication. This can be run from the web.
Note - I have checked BlazeMeter Tutorial which uploads doc as Body Data while I use File Upload tab.
Here is how my request looks -
On execution I get following Request -
POST https://xxx
POST data:
<actual file content, not shown here>
[no cookies]
Request Headers:
Connection: keep-alive
Content-Type: multipart/form-data
Accept-Language: en-US
Authorization: bearer <>
Accept: application/json
Content-Length: 78920
Host: test-host
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_102)
And the request fails with 400 error -
Response code: 400
Response message: Bad Request
Since I am able to carry out file upload using curl, I assume that I missed the some configuration with JMeter. Curl looks as -
curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Authorization: Bearer <>' -F upload_file=#"test.pdf" 'https://xxx'
What did I miss in JMeter file upload?
Another vote for using the Java implementation in the Advanced tab in Jmeter. My headers and body were exactly the same between postman and jmeter, but it wouldn't upload my file (got response code 415) until I changed to the Java implementation.
If you can successfully upload file via curl, why don't you just record the upload through JMeter HTTP(S) Test Script Recorder like:
curl -x http://localhost:8888 -X POST --header 'Content-Type....."
If you still need to build the request manually consider two important bits:
You need to check Use multipart/form-data for POST.
The most significant, you need to supply "Parameter Name", According to HTTP Request Sampler Manual:
For the POST and PUT method, if there is no file to send, and the name(s) of the parameter(s) are omitted, then the body is created by concatenating all the value(s) of the parameters.
Looking into curl command manual in your case the "Parameter Name" should be upload_file
So the final configuration should look like:
See Performance Testing: Upload and Download Scenarios with Apache JMeter guide for above steps described in details.
My backend server is implemented in Java and in the file upload request I had to select the Impolementation as Java!
Here is the file upload section
thank you for the JAVA implementation of HTTP! file uploads are working again for me which haven't worked since 2.13
here's my post else where:
I had same issue...thought jmeter was doing something wrong since this stuff worked for me in 2.13...hasn't worked since version 3. well..saw a post somewhere that said, using the JAVA implementation of HTTP worked. Guess what? it did work for me too!!! I've been struggling trying to dissect every part of the POST. I was doing it right all along, just needed JAVA implementation of HTTP and voila!
hope that helps!
Has anyone been able to use the WebSphere Liberty REST API to deploy remote Docker containers? The docs describe all the steps, but I am not able to repeat the results. I get an error when calling REST deploy function (details are posted on the other forum).
If anyone was able to do it - please let me know and would be great if you share how you were able to do it.
Not long after posting this question I tried using the curl command with the JSON header spec and now it works. Here is the curl command I am using that works:
curl --verbose --insecure -X POST --data #docker_deploy.json --header "Content-Type: application/json" -u ${ADMIN_USER}:${ADMIN_PASSWORD} https://${CONTROLLER_HOST_NAME}:${CONTROLLER_PORT}/ibm/api/collective/v1/deployment/deploy
I integrated linkedin with Rails 4 and trying to share post on linkedin.
I used curl in rails and post on linked-in wall using below curl post. I used below code in rails console and its work fine but when i used it in rails code with system and single quote then issue create because already single quote use in inside.
system 'curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"comment":"hello from system www.google.com! http://google.com","visibility":{"code":"anyone"}}' https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=xxxxxXygzp_8E3xxvg7_7FaxxxxxxnxtWzBXAxxxxa0wta5z1MVK6-kubHJ5JxxxndpAMc_CxmCsIHxFlxxx0t_WNEhxxxMz8_cKpeOidAxxx5-X-MdvzYVxxQ&format=json&title=linkedin HTTP/1.1'
What do I have to add to resolve this issue? I tried a lot then I posted here.
Thanks in advance.
In your application (as opposed to in the terminal), I suggest you use an HTTP library (I use HTTParty, but there are many options).
I'm trying to make use of the CO-OP API for some purposes in my app (http://coopapp.com/api)
I know how to preform the request using curl:
curl http://coopapp.com/groups/20/statuses -H 'Accept: application/xml' \ -H 'Content-Type: application/xml' -u email:password
But I can't figure out how to do this in iOS, hopefully somebody can give me a push in the right direction.
You do that with the NSURLConnection class. But I recommend using MKNetworkKit which is a handy wrapper around it. It actually even shows the equivalent curl command in the description of its operations.
If you want to load the same web page use UIWebView,Same HTML page will be loaded