I have a Zabbix web monitoring task where I need to pass in JSON data to the URL via a http post. For example, the curl command to run this request is:
curl -H "Content-Type: application/json" --data #myData.json https://example.net
When I am configuring the Zabbix web monitoring task, where do I put this JSON data?
I see under the "Step of the web scenario" there are fields for 'Post', 'Variable', and 'Headers'. Does the JSON data go directly in one of those fields?
curl --data => it's POST request => paste your JSON data into Zabbix Post field + you need to set JSON header in the Zabbix Headers field: Content-Type: application/json.
Related
I am doing automation to get opening tickets details so i am executing web service call in FreshService ticketing tool.
Below is my web service call using CURL and GET
curl -X GET -H 'Content-Type: application/json' -v -i 'https://support.XXXXXXX.com/helpdesk/tickets/9725.json?-u=ASDDDECDFF%3AX%20'
When i am executing only getting below response in body.
{
"require_login":True
}
But my output joson file visible after opening that url in browse i can see json file, so i execute below vbsctipt to send HTTP request for read the JSON file but same ""Require_login":True" coming.
Dim o
Set o = CreateObject("MSXML2.XMLHTTP")
o.open "GET", "https://support.XXXXXXX.com/helpdesk/tickets/9723.json", False
o.send
msgbox o.responseText
So my expectation to get JSON file in body part of web service response or through vbscript get JSON file store locally.
Appreciate any other light wight tool or easy approach. More about Fresh service API details https://api.freshservice.com/#introduction
After i encoded my authentication key with base64 and addd Authorization as header and its working now.
Update Web service URL,
curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic XXXXXYYYYYZZZ' -v -i 'https://support.XXXXX.com/helpdesk/tickets.json'
I checked their API documentation and didn't find anything useful that gives me the ability to create snapshots of the URLs I choose.
Submitting a POST request to the root path (https://pragma.archivelab.org) with JSON data containing url (String) and annotation (Object) fields will save a snapshot of url using the Wayback Machine and store the annotation object, making a bidirectional link between the stored snapshot and annotation entries.
Here's an example of such a request:
curl -X POST -H "Content-Type: application/json" -d '{"url": "google.com", "annotation": {"id": "lst-ib", "message": "Theres a microphone button in the searchbox"}}' https://pragma.archivelab.org
I need to generate a Json response for a POST made with parameters in form data, not in Json.
Example:
My request:
curl -X POST -H "Accept: application/json" -H "Content-Type:
multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
-F "firstName=Manolete" -F "lastName=Manolón" -F "address=villa arriba" -F "city=meryville" -F "telephone=666666666" -F
"homepage=alguna.homepage.es" -F "email=alguno#hotmail.com" -F
"birthday=1314595427866" "http://localhost:8080/PetClinicRoo/owners"
Current request:
curl -X POST -H "Accept: application/json" -d '{firstName: "Manolete",
lastName:"Manolón", address:"villa arriba", city: "Meryville",
telephone:"66666666", homepage:"alguna.homepage.es",
email:"alguno#hotmail.com", birthDay: 1314596527943, }'
"http://localhost:8080/PetClinicRoo/owners"
I could handwrite the code but this implies getting out of spring roo management all the application web tier, and further modifications wouldn't be automatically made.
You can push-in the controller method and you modify it as needed, Spring Roo management will work.
We have several options:
1.- Use spring roo and then pushing in the methods
Generate all the web tier using spring roo
Pushing-in all the post methods
Modify the response
Inconvenients: once you push-in the methods, spring roo doesn’t manage them, so further modifications woldn’t be made automatically
2.-Handwrite the web tier.
Use spring ro to generate entities
Handwrite the web layer
Inconvenients: implies more work than the previous option.
3.- Extend Spring Roo in order to generate the method automatically.
I think this is our best option because he have a lot of entities.
I am having trouble requesting the current status of a resumable upload. Based on the Google Documentation, the following request should return a Range header with the current range google has of my upload, but I keep getting the following response:
Failed to parse Content-Range header
Here is my curl request:
curl -H "Content-Range: bytes */1443452365" -H "Content-Length: 0" locationUrl -X PUT
I have also tried "bytes */*" and "*/*" for the Content-Range header, but no luck.
Any ideas?
First, you need to check the correct request format like the sample given below:
curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":100}' http://localhost/api/postJsonReader.do
And, discussed in other command-line tools, when sending raw HTTP data, be aware that the POST and PUT operations will require computing the value for a Content-Length header. You can use the UNIX tool wc to compute this value. Place all the content of the HTTP body into a text file such as template_entry.xml (example used above) and run wc -c template_entry.xml. It is often difficult to debug if you accidentally use an incorrect value for the Content-Length header.
Lastly, you can request the status between chunks, not just if the upload is interrupted. If the upload request is interrupted, follow the procedure outlined in resume an interrupted upload.
I'm running a tomcat server with a REST service on localhost.
This url typed in the browser gives me a json response: http://localhost:8080/a/rest/dataset/list
But when I use curl: curl http://localhost:8080/a/rest/dataset/list the response is HTML code with a 404 error from the server.
What am I missing in the curl command?
Tomcat may be waiting for a specially formatted HTTP request from the user. As you are expecting a response in json, you should probably forward the following argument to curl :
-H 'Content-Type: application/json'
Also, you may always specify to whatever HTTP server the response you are expecting him to return. A lot of back-end application based on HTTP are issuing a response given the HTTP request.