IBM cloud function API(API connect) is not accepting non english characters or + in the parameter - apiconnect

We have IBM cloud function API which accepts filename as a parameter. If I give filename which includes + or non english characters(chinese,japanese, etc) the api is returning 404 with message:"Error: Whoops. Verb not supported."
Please can you help me on this.

"Error: Whoops. Verb not supported."
This response from APIConnect when you consume the API implies Invoke action is not happening, that means input parameters are not as per expectation.
The backend of API Connect of every action in Assembly section is developed on JS and XSLT. Mainly for INVOKE action, it uses the concept of OpenURL to invoke the backend REST service.
From my understanding, JS will accept non-English and "+" operators but it will be part of the string - what I mean is this will not concat two strings.
Please try to drag "Gateway" action to the policy and execute the command
console.error("Input Req ::"+apim.getvariable('request.verb'));
Please share the response what you get in the DataPower gateway for this invoke.

Related

Getting generic page error in response, using JMeter in .NET site

When using .Net application,
and checking error logs,
getting below error: Object reference not set to an instance of an object.
Most probably you're sending the wrong request due to missing or improperly implemented correlation
So if you have recorded a request using HTTP(S) Test Script Recorder most probably there is at least one parameter there which is supposed to be dynamic, to wit
extracted from the previous response using a suitable JMeter Post-Processor
stored into a JMeter Variable
and the dynamic variable to be sent along with the request instead of recorded hard-coded value
In .NET web applications the most commonly used parameter is ViewState, however other may also be required like EventValidation
so given you properly handle these dynamic parameters you should start getting "good" responses, see ASP.NET Login Testing with JMeter for example handling of the dynamic parameters.
Also don't forget to add HTTP Cookie Manager to your test plan.

In Talend API tester, how to send a request without evaluating environment variables in ${}

I have a request I want to send using Talend API tester.
In the request there are instances where I want to send a payload such as:
{ "channel" : "${channelId}" }.
But Talend API tester evaluates anything in a ${} as an environment variable, thus they payload sent will be in the form:
{ "channel" : "channelId" }.
Is there any way to force the API tester to ignore the ${} delimiter, and send it with the payload so that it may be evaluated internally once it has reached the server.
My issue was caused by using "Talend API Tester" as my API Client software.
This API tester allows for Environment Variables to be set which will be evaluated before the payload is sent.
Since I had no environment variable set to "channelId" the content: ${channelId} was being evaluated to just "channelId".
To solve the issue I have found two solutions:
Use a different API Client such as Postman API Client.
Set Talend API Tester to not evaluate Environment Variables by unchecking the [Enable Body Evaluation] button just below the Body section in the Talend API Tester. ( I had looked into the main Settings, but never found any solution. It wasn't in the Settings, but on the middle of the main Client)

Query parameter values starting with # is not getting considered in Postman

I developed one application in Mulesoft for calling a SOAP webservice. While making GET call to a SOAP web service from Postman, query parameter value starting with # is not getting considered by my Mulesoft mapping.
e.g: http://localhost:8080/appName?queryParam1=#abc
In my mule application, the value for queryParam1 is coming as empty value. Could some one explain the technical reason for this. Is # is considered as escape character from Postman or Mulesoft Transform Message activity? Thanks in advance
I also faced the same issue in my API, in URI anywhere in between comes the '#' character the rest of your URI will go blank and the 404 HTTP error will occur.
I suggest you to get the value in query parameter without # character and later in the API code or flow prefix it. This will work.
Hope this will resolve your problem.
You will have to encode characters such as #. Refer this link for complete list of such characters. In your example:
Change: http://localhost:8080/appName?queryParam1=#abc
To: http://localhost:8080/appName?queryParam1=%23abc

RAML mocking service POST request showing 404 Error in Mule design center

I am using mocking service feature to build and test API design for one of the POC. I am getting HTTP error code 404, when posting message from design center through mocking service.
See the attached picture as well:
GET, PUT and POST request with without URI parameter are all working fine, but whenever I try to explicitly pass a specific gid or cid with the POST method it is showing the error from above.
I am attaching RAML file:
https://forums.mulesoft.com/storage/temp/6224-test.txt
I have read the documentation and have understood that we can pass any parameter value, when testing API with the mock service.
Could you please help me to find out, why the POST request with a specific gid or cid is returning an error code?
Based on the attached sceenshot you are trying to POST something to the root path of your API Mock Service.
Instead of deleting the parameters and sending the HTTP POST request to an URL like:
https://mocksvc.mulesoft.com/mocks/29b2eb87-675e-4aa2-8ae3-c5d13e99e441/
Please try to keep the URI in the correct format:
https://mocksvc.mulesoft.com/mocks/29b2eb87-675e-4aa2-8ae3-c5d13e99e441/groups/{gid}/channels/{cid}/chatthreads
In this URL you just have to replace the gid and cid parameters in the curly braces to the actual values.
Using your RAML file and a URI in the correct format, like the followine examples:
https://mocksvc.mulesoft.com/mocks/29b2eb87-675e-4aa2-8ae3-c5d13e99e441/groups/10/channels/5/chatthreads
https://mocksvc.mulesoft.com/mocks/29b2eb87-675e-4aa2-8ae3-c5d13e99e441/groups/10/teams
I am getting "204 No Content":
But when I remove the parameters and try to execute the HTTP POST on the wrong path, then I get "404 Not Found":
Based on the screenshot you have provided; the path to the resource was not complete in your HTTP request. This could have caused the HTTP error code "404 Not Found".
Please make sure that the full path to the resource is set in the API Console. This is needed to be able to identify what resource you want to POST (create).
For details about the usage of special characters (like '-' or '$') in the names of resources; please see the raml-js-parser. This parser is being used by the API Designer.
At the moment there are still open issues related to the handling of special charachters, like '-'. Please see the related bug report: Resource name is invalid: illegal character #129 in the github repository of raml-js-parser.
I would suggest to be using no special charachters in the resource names. (even though the current RFC standards eventually do allow the usage of '$')
According to this; the resource name "$ref" seems to be causing problems in your RAML. Please consider filing a bug report for the API designer in their github repository. However the issue could be caused by the parser as well...

OpenID Connect Persist ID Token to Server-side Callback Function

Suppose that I invoke the following HTTP request:
https://accounts.example.com/oauth2/auth?
scope=openid+email&
nonce=53f2495d7b435ac571&
redirect_uri=https%3A%2F%2Foauth2demo.appspot.com%2Foauthcallback&
response_type=id_token+token&
client_id=753560681145-2ik2j3snsvbs80ijdi8.apps.googleusercontent.com
Which yields the following redirect response:
https://oauth2demo.appspot.com/oauthcallback#
access_token=ya29.AHES6ZSzX
token_type=Bearer&
expires_in=3600&
id_token=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiY...
What is the point of the callback parameter, given that the returned metadata, containing id_token, etc., is positioned after a hash fragment in the URI, and are therefore not persisted as parameters to the callback function? How can a server-side callback receive the various tokens?
The response type that is used here is a so-called "Implicit" response type which is primarily meant for in-browser (e.g. Javascript) clients, in which case the Javascript code that is served on the callback URL can access the parameters in the fragment. Web applications should do either one of:
stick to the code flow which is meant for web application clients
use the Form Post response mode (http://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html) if supported by the OP
serve Javascript on the callback URL that parses out the parameters from the fragment and POSTs them to the server
Bottom line is that if you need the tokens server-side, you should most probably use the code response type.