Does Splunk offer any such solution to make a call to SOAP REST HTTP URL and to test their availability? - rest

I need to create some kind of health check in Splunk that calls a Rest URL every hour and check if the response returns HTTP code 200 and send an alert in case there is an error like http code 400 or http code 500.
For example Splunk should make an http call to the URL of my application every hour and check if the URL of my application returns HTTP code 200. In case the response from the URL has a different code than 200 then send a notification email telling that something is wrong.
is that possible?
Please help.

Check out the REST API Modular Input app at https://splunkbase.splunk.com/app/1546/.
You can also create a Python program that checks the URL and reports on its health. Schedule that program as a scripted input.

You can use the website monitoring app for Splunk, https://splunkbase.splunk.com/app/1493/ to get the return codes for your endpoints

Related

Including a body in a GET, PUT, or POST request results in response of "You need to enable JavaScript to run this app"?

The short story: If I hit my endpoint /api/something with a PUT and no body, it goes through to my Lambda (via CF -> API GW -> Lambda). If I add a body to the request, it doesn't work and seems to die before hitting the API Gateway. I'm not sure why it would do this.
The long story:
I've set up a CloudFront distribution that sends requests to /api to our API gateway and all other requests just vend static website resources.
It has been working great so far for our simple use cases. We previously only hit the API Gateway with GET requests, but now we're going to start needing to send PUT or POST requests to the API Gateway. I had to update the CloudFront distribution "behaviors" for the /api path pattern (the one going to the API gateway) to allow all HTTP methods after that, I was able to start getting responses from the API Gateway for PUT and POST responses (previously only worked for GET).
However, I noticed that if I try to send a payload or body with the request (regardless of the request type), I don't think it actually hits the API Gateway or the Lambda that the API Gateway is routing to because I get a response of "You need to enable JavaScript to run this app". I tried looking at the logs but couldn't find anything. The heads shows "Error from cloudfront" but I'm not sure why or where to find what the error was.
Any tips on how to troubleshoot this or what the issue might be?
Update (10/8): I figured out the "enable javascript" thing was coming up because of my custom error pages for 403&404 errors. I deleted them in my development environment and now get a clearer error.
"This distribution is not configured to allow the HTTP request method
that was used for this request. The distribution supports only
cachable requests. We can't connect to the server for this app or
website at this time. There might be too much traffic or a
configuration error. Try again later, or contact the app or website
owner."
However, I still don't know what to do, as the request type (PUT) is enabled and the request works as long as I don't provide a body. Not sure how to get it to be ok with a body at the moment.

How to Start an UiPath Robot from ServiceNow via REST API

How can I start UiPath Robot that is connected to UiPath Orchestrator? I want to send REST API commands to the Orchestrator from ServiceNow Interface.
First get your personal url of schema
https://platform.uipath.com/[account_logical_name]/[service_instance_logical_name] ...
Overall you need to request this to get the logical name: https://platform.uipath.com/cloudrpa/api/getAccountsForUser
Here are the steps to do so:
Run JavaScript code in the browser, which will give you the Code challenge and Code verifier.
Modify the account.uipath.com URL with Code challenge and send a request in the Browser itself. Which will ask you to authenticate with the credentials.
You need to pass this URL in browser and the browser URL will give back the authorization code.
Then you need to send request to https://account.uipath.com/oauth/token with body.
There you will get the bearer token.
You need to get the logical name, so again a request for https://platform.uipath.com/cloudrpa/api/getAccountsForUser you will get the name.
With all these, try to send the request again.
When you need more help please have a look on several links as they show even better how to do this in e.g. Postman:
https://forum.uipath.com/t/orchestrator-api-how-to-trigger-a-process/15471/18
https://forum.uipath.com/t/start-a-job-in-orchestrator-via-the-api-in-community-edition/145363/3
https://docs.uipath.com/orchestrator/reference/about-odata-and-references#consuming-cloud-api
https://www.youtube.com/watch?time_continue=417&v=a2YlQMylshU

Wiremock fake that a service is down

In my current setup, if one of my services is down and a request is made to that service, I send a certain HTTP code in the response.
Now to test this I'm using Wiremock to mock my service. Is there a way to mock that the service is unavailable and return a specific response as a result?
I've tried looking through the Wiremock code but there are barely any comments for the methods. I've also tried looking through the docs and I couldn't find anything about bringing down the service.
you could try ResponseDefinitionBuilder.aResponse().withFault(Fault.CONNECTION_RESET_BY_PEER), ResponseDefinitionBuilder.serviceUnavailable() or simply point your client to a port that is guaranteed to have no listeners, depending on what exactly would you like to test with
service is unavailable and return a specific response as a result

Has anyone succeeded in interfacing Cherwell with the Twilio REST API to send SMS messages?

I have been successful with sending messages to Twilio via C# and Powershell but trying to use a Web Service call in Cherwell has me stumped.
I have setup the web service call.
I'm passing all the authentication tests because I can perform a lookup for the last 50 messages (which requires authentication) but when I try to call the Messages POST with To, From and Body I get a 400 error.
Unfortunately Cherwell only shows me the 400 error and not the return text from Twilio so I can't debug any further.
If anyone has done this can you please let me know how?
Also if you could recommend a way to put an HTTPS proxy between my Cherwell server and the Twilio endpoint to view the result values, that would help me out.
The key to this is building the message body as a single block of text that should be used as the body of the Web Service call.
Essentially, what you would have is a value that looks like
From=+17195550199&To=+17195550100&Body=Your text message here
I ran into this same issue while building this mApp to provide outgoing SMS capabilities: https://synapsesoftware.com/portfolio/twilio-mapp

What's the REST way to verify an email?

When a user register to my web application I send an email to verify his inbox.
In the email there are a link to a resource like this:
GET /verify/{token}
Since the resource is being updated behind the scenes, doesn't it break the RESTful approach?
How can I do it in a RESTful manner?
What you are talking about is not REST. REST is for machine to machine communication and not for human to machine communication. You can develop a 1st party REST client, which sends the activation to the REST service.
You can use your verification URI in the browser to access the REST client:
# user follows a hyperlink in the browser manually
GET example.com/client/v1/verify/{token}
# asking the client to verify the token
and after that the REST client will get the hyperlink for verification from the REST service and send the POST to the service in the background.
# the REST client follows the hyperlinks given by the service automatically
# the REST client can run either on the HTTP client or server side
GET example.com/api/v1
# getting the starting page of the REST service
# getting the hyperlink for verification
POST example.com/api/v1/verification {token}
# following the verification hyperlink
If you have a server side 1st party REST client, then the HTTP requests to the REST service will run completely on the server and you won't see anything about it in the browser. If you have a client side REST client, then you can send the POST in the browser with AJAX CORS or you can try to POST directly with a HTML form (not recommended). Anyways the activation should be a POST or a PUT.
It depends on what are you trying to do.
Does it fire an email after validating the user for example? If so, it is not an idempotent method and you should use POST.
Example:
POST /users/{id}/verify/{token}
If the method doesn't have any consequence besides the update, I think you should use PUT.
Aren't you overthinking REST? With e-mail verification you want the user to be able to simply click the link from whatever mail user agent he is using, so you'll end up with a simple GET on the server (presented as a hyperlink to the user) with the token either in the path or as part of the query string:
GET http://example.com/verify-email/TOKEN
GET http://example.com/verify-email?token=TOKEN
Either is fine for this use case. It is not really a resource you are getting or creating; just a trigger for some process on the backend.
Why do you think this would run afoul of good design?