apigee policy status disabled for /callback endpoint - apigee

I am working on /callback endpoint of a apigee proxy.
In one of the apigee policy i am trying to save the value of state which is generated in /authorize endpoint.
I am using assign message policy for ths.
<Assignvariable>
<Name> callbackstate </Name>
<Ref> request.queryparm.state </Ref>
</Assignvariable>
But when i hit this /callback endpoint this policy status shows "Disabled" and its not saving in callbackstate.
I am not able to understand why its showing disabled ?

Related

POST call converting to GET

I am new to apigee.
I am trying to make a post call in apigee with queryparameters.
The flow is below.
Client send request --> verify API key ---> extract payload --> remove access token --> call target endpoint conditional based on POST
I am using curl command to make POST call.But issue is while calling target endpoint its taking as /GET call and condition is evaluating to false.
Apigee can convert in inbound POST to a back-end GET. In Apigee that means using a policy to rebuild the call, to use a GET method (verb) on your target back-end, when you need to receive a POST from your upstream calling client. You will need to use the AssignMessage policy. These product docs are exactly what you need to review:
https://docs.apigee.com/api-platform/reference/policies/assign-message-policy#set-verb
Example, AssignMessage:
<AssignTo type="request" createNew="false"/>
and
<Set> ... <Verb>GET</Verb>
Note though that when converting the method (verb) from POST to GET, the policy will not automatically convert the POST's form parameters to query parameters. You will need to use the <Add> and/or <Remove> functionality of the AssignMessage policy to manipulate the message further. Example use in the AssignMessage policy to add the queryparams, referencing the formparams:
<Add>
<QueryParams>
<QueryParam name="q1">{request.formparam.q1}</QueryParam>
</QueryParams>
</Add>
Credit to user Michael Russo for his Answer about this from eight years ago.

Mule calling rest api fails with " Response code 404 mapped as failure. "

I am trying to consume a rest api via mulesoft but from postman when i invoke the mule endpoint it gives the following error "Response code 404 mapped as failure."
<http:request-config name="HTTP_Request_Configuration" host="xxxxx" port="80" doc:name="HTTP Request Configuration" basePath="/xxx/Members"/>
<http:request config-ref="HTTP_Request_Configuration" path="/{mID}/Members" method="GET" doc:name="HTTP">
<http:request-builder>
<http:uri-param paramName="mID" value="#[flowVars.memID]"/>
</http:request-builder>
</http:request>
The error message you are getting in Mule indicates that the REST API you are calling from Mule is returning a 404. This means that you are requesting a resource that doesn't exist.
Check your config and the service you are consuming to make sure they match. From your code above the URL that Mule will be requesting is:
http://xxxxx:80/xxx/Members/{mID}/Members
This is built up from the host, port and base path of the HTTP config along with the path of the HTTP Request component.
Not having any knowledge of the API you are trying to consume I can't tell you what it should be in your specific case. If you have documentation that describes the service you should be able to adjust your mule configuration to match it.
Hope that helps.
Johnson.

Add authorization from REST client to http request in mule

We have the authorization header sent from a REST client and this can be seen in the inbound properties after the HTTP listener connector at the start of the mule flow in 3.7.
We call an API in the same flow using a http request configurator and want to send the same authorization header in the call.
We have added it as a header in the parameter section in the http request configurator but it fails. How do we do this?
You can directly copy the Authorization property using the copy-properties message processor, something like below:
<http:listener config-ref="HTTP_Listener_Configuration" path="/" allowedMethods="GET" doc:name="HTTP"/>
<copy-properties propertyName="Authorization" doc:name="Property" />
<http:request config-ref="HTTP_Request" path="/test" method="GET" doc:name="HTTP"/>
I think you need to use a Message Property component and set your authorization in an Outbound Property before calling your HTTP:
Your Property will be:
I hope this can help you.

Mediation sequence for DELETE method in wso2 not working

I have a SOAP web service for delete action, with endpoint URL
http://some-ip-address:my-port/bank/websrv/delcus
And can be invoked only by POST method.
I have published this API and added DELETE resource for invoking this service.
So the URL becomes
https://my-apim-endpoint/public/customer/{customer-id}
And I added mediation sequence for DELETE action. So whenever this API is invoked, it will go through the mediation sequence and send POST request to the endpoint
http://some-ip-address:my-port/bank/websrv/delcus
But when I invoke the API, the endpoint URL is getting replaced with the following URL.
Here is how the send mediator looks like,
<send>
<endpoint>
<http method="post" uri-template="http://some-ip-address:my-port/bank/websrv/delcus"/>
</endpoint>
</send>
http://some-ip-address:my-port/bank/websrv/100000023
Instead of
http://some-ip-address:my-port/bank/websrv/delcus
And giving me error response. Please anyone can help?
When you use http type endpoint, the resource path get appended to the endpoint url. for example say you have an endpoint http://test.com/path and if you have defined a /resource/{id} resource, then the request will be sent to http://test.com/path/resource/{id} kind of a url. That is the default behavior.
To call a SOAP service instead of using http type endpoint, you can use use address endpoint type. when you create endpoint with address type, you can define whether it is a soap11 or soap12. (format option in advanced options section in the implement tab). this will send a soap payload to http://test.com/path. (you do not have to build soap headers etc. only message body) .

Which policy do I use for redirect RaiseFault or AssignMessage?

I want to do a redirect during API processing..basically redirect to my login page and require the user to authenticate. Should I use AssignMessage or RaiseFault Apigee Policy? And, what's the difference?
A Raise Fault Policy will stop all processing and return the payload to your client. AssignMessage will keep on going to the backend target and running policies only with the new Payload that you define.
So... RaiseFault.
And, as in the comments, the RaiseFault policy will only be recorded in Analytics as an error if you return a non-success code (2xx and 3xx are not considered errors so if you do a 302 redirect, it won't be tracked as an error).

Resources