error with submitting page using curl..in shell script - bash

using below command in shell script:
DATE="2017/04/18"
curl --data "transactionNumber=12520264&traceNumber=466245&serviceDate=${DATE}" http://isp:7005/ClaimUtility/claimReversal
Getting below response:AS ERROR
<p><b>message</b> <u>Request method 'POST' not supported</u></p>
<p><b>description</b> <u>The specified HTTP method is not allowed for the requested resource (Request method 'POST' not supported).</u></p>
what should be the correction required??

This means that the endpoint you're trying to post to http://isp:7005/ClaimUtility/claimReversal does not support POST requests.
You can try using GET and the content will be encoded as application/x-www-form-urlencoded on the url as query params.

Agree with John Weldon
endpoint you're trying to post to http://isp:7005/ClaimUtility/claimReversal does not support POST requests.
So i have corrected the URL which is supporting POST form
ie.http://isp:7005/ClaimUtility/claimReversalReversal

Related

How to submit a page in Oracle Apex using curl

I have a login page in an Oracle Apex application that works fine with a normal web browser like chrome. However when i try to perform the same operation using CURL (command-line browser), a HTTP 404 error is returned:
Request:
curl -i -d "P9999_USERNAME=MOIZ&P9999_PASSWORD=xxxx" -X POST http://localhost:8080/apex/f?p=101:9999:0:
Response:
HTTP/1.1 404 Not found
Server: Oracle XML DB/Oracle Database
Content-Type: text/html
Transfer-Encoding: chunked
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not found</TITLE>
</HEAD><BODY><H1>Not found</H1>
The requested URL /apex/f was not found on this server</BODY></HTML>
Using a normal browser, there are two sever request: one GET and one POST. However when using curl i am just making a single POST request.
Is that difference the cause of problem?
Is it possible to POST apex page without calling GET?
If yes then whether this solution will also work for file uploads?
Based on the post Python web scraping with BS using correct url? I was able to get answer to my above questions. [although this post uses python's requests and BeautifulSoup libraries for demonstration purpose, I think with some shell/windows scripting it may also be achievable with curl too]
Is that difference the cause of problem?
For POST request in APEX, we need to first perform a GET request as APEX expects the following hidden items to be sent as a payload of POST request
p_flow_id # application id
p_flow_step_id # page id
p_instance # session id
p_page_submission_id # page submission id
p_request # request
p_md5_checksum # md5 checksum
p_page_checksum # page checksum
p_arg_names # list of arguments
In addition, you may also need to add your page specific input items. For example,
p_t01 # username
p_t02 # password
Is it possible to POST apex page without calling GET?
For reasons mentioned in above answer, GET request will be required before POST request can be performed.

Accessing API layer

I am trying to access an api function, for example I want to access the login function, I get the following error:
"message": "An internal error occurred during your request!",
Looking in the log file, the following log is there:
ERROR 2017-10-09 17:01:37,296 [11 ]
nHandling.AbpApiExceptionFilterAttribute - Processing of the HTTP
request resulted in an exception. Please see the HTTP response
returned by the 'Response' property of this exception for details.
System.Web.Http.HttpResponseException: Processing of the HTTP request
resulted in an exception. Please see the HTTP response returned by the
'Response' property of this exception for details.
I am using Postman to test. My URL is https://localhost:44347/api/Account/Authenticate. My header has Context-Type as "application/json" and in my Body I have the loginModel formatted as
{
"tenancyName": "tenantname",
"userNameOrEmailAddress": "admin",
"password": "123qwe"
}
Am not sure how else to proceed on this. Any ideas please? I have swagger installed as well.
I am using MVC + AngularJS template. I have not changed anything, just the default project.
Appreciate the assistance.
I have tested with Fiddler and it works correctly.
Note: make sure you type Content-Type correctly, on the question you typed Context-Type
Make a POST request! You may be missing this.

Using Gin: How to pass original JSON payload to a Redirect POST

I'm a newbie when it comes to Go and Gin, so please excuse my ignorance.
I've setup a server using Gin which supports a POST request. I would like the user to POST their request which includes a required JSON payload redirecting that request to another URL. As part of the redirect I need to pass the original JSON payload. For example, if the user issues this CURL request:
curl -H "Content-Type: application/json" -d '{ "name": "NewTest Network", "organizationId": 534238, "type": "wireless"}' -X POST "http://localhost:8080/network"
My Gin code does this:
r.POST("/network", func(c *gin.Context) {
c.Redirect(http.StatusMovedPermanently, networks_url)
})
where: networks_url is the redirected URL. I need a way to pass the original JSON payload to the redirected URL.
Any help you could provide would be greatly appreciated.
This doesn't have anything to do with Go or gin.
This is the expected behavior of a user agent, which should change the method from POST to GET with either a 301 or 302 redirect.
To instruct the user agent to repeat the request with the same method, use 307 (http.StatusTemporaryRedirect) or 308 (http.StatusPermanentRedirect).
You must use 301 or 302 as a redirect status code.
c.Redirect(301, "http://www.google.com/")
Please refer the documentation here.
I've got the problem too many requests (loop), so I'm fine with this one.
if err != nil {
session.AddFlash("The error I would like to show.", "error")
c.Redirect(http.StatusMovedPermanently, "/my/route")
return
}

REST API from Javascript - Invalid HTTP status code 405

new Parse developer here looking for some help.
I'm trying to call the REST API from my app to log custom analytics, but for some reason the XMLHttpRequest I'm making fails with the error message:
XMLHttpRequest cannot load https://api.parse.com/1/events/marker. Invalid HTTP status code 405
Here is the code I am using to make the request:
xmlhttp.open("POST", "https://api.parse.com/1/events/marker", true);
xmlhttp.setRequestHeader("X-Parse-Application-Id","appidhere");
xmlhttp.setRequestHeader("X-Parse-REST-API-Key","apikeyhere");
xmlhttp.setRequestHeader("Content-Type","application/json");
xmlhttp.send('{"dimensions":{"action":"showDetails"}}');
This is the console output:
OPTIONS https://api.parse.com/1/events/marker (index):3639(anonymous function) (index):3639S.trigger main.js:15(anonymous function) VM625:31(anonymous function) VM623:11S.trigger main.js:15L.zc VM622:132L.nn VM622:132(anonymous function) main.js:13S.trigger main.js:15L.kl VM622:116(anonymous function) main.js:16
XMLHttpRequest cannot load https://api.parse.com/1/events/marker. Invalid HTTP status code 405`
The strangest thing though is that when I make the request using the curl example in the documentation it works perfectly fine. :/ Any ideas what I'm doing wrong? Hoping it's something simple that I'm overlooking. Thanks!
An HTTP 405 error is Method Not Allowed. The resource you're trying to hit does not accept the POST method.
Be certain that the resource you're trying to hit supports POST; if it doesn't, you'll have to change your XMLHttpRequest accordingly.

Codeigniter http request and 404

I have a problem with Codeigniter.
This is my code:
http://pastebin.com/scccVP8D
If my url is: example.com/validator/validator/value/323445
Http request response:
323445
404 Page Not Found
The page you requested was not found.
Why do i get an error 404?
I don't see value/323445 anywhere in your code. You just have function validator without any parameter.
So, when you call example.com/validator/validator/value/323445 the page don't egsist.
You need to delete parameter or to add parameter in function and to use it.

Resources