Why I get unexpected result error when testing REST API? - wordpress-rest-api

When testing the REST API, an unexpected result was returned:
REST API Endpoint: https://valbrunpro.com/wp-json/wp/v2/types/post?context=edit
REST API Response: (404) Not Found
Disabled cloudflare to see if it was inadvertently blocking the Rest API. Disabled cache plugins to see if they were causing the conflict but none of these fixed the issue. Still receiving error message in site health about the Rest Api.
Needed to know how to authenticate my site with REST API through .htacess file?

Related

amazon api gateway returns 403

I am calling a serverless api(apigateway+lambda) from lambda from another aws account with axios, returns 403 http status with payload { message: "Forbidden" }. the get http call returns data when used in chrome
looking at the comments which say that the headers included "x-amzn-errortype: ForbiddenException", that happened for me when I had not deployed the api yet. After deploying the api, that error went away

WSO2 API manager returns binary response

I am very new to WSO2 API manager and trying out my very first simple restful api. which returns json response and has no security since it is an internal api.
I installed WSO2 API manager locally and trying to call the rest api on my dev server which uses http and no security as I mentioned earlier.
Here is how my get url looks like:
and here is my url looks like for production and sandbox environment:
I don't have any message mediation enabled.
I went to the API store and created a trial application (so that I can get the access token. Eventhough, my dev environment api has no security, I was reading that for throttling and other purpose, I need to pass bearer token to the WSO2 api OR it will reject the request.)
When I am trying to consume the api, I get the following binary message.
Is there any way I can see the proxy log on WSO2 server so that I can see the request and its header sent to my dev server?
How can I fix this binary response to get the proper json response?
I searched all over and can't find solution to it.
You can use below steps on WSO2 ESB or APIM to enable Wire Logs.
Uncomment below line in /repository/conf/log4j.properties
log4j.logger.org.apache.synapse.transport.http.wire=DEBUG
Restart Server.
Source - http://lakshanigamage.blogspot.com/2015/03/how-to-enable-wire-logs-in-wso2-esbapim.html

AWS API Gateway - error 403 on resource not found

It seems an HTTP response of 403 is accepted as the norm and correct handling of any calls made to a resource or endpoint that does not exist on an API Gateway setup (this post).
Example: a call to a non-existing endpoint on my Gateway would be;
GET -- https://{{MyGatewayDomain}}/api/v1/blah
This would return a 403 forbidden. Which can be rather confusing and misleading.
I'd like to know if anyone has managed to configure their API Gateway so that any call to a non-existing endpoint / resource, returns what I would have thought is a correct response of a 404?
Thanks in advance.
EDIT
As per bejos-aws's suggestion, I am able to override the default behaviour of the 403 Missing Authentication Token however, this will not solve my issue as then all the valid 403 errors would return a 404 response which is incorrect.
Also, my issue is regarding a 403 forbidden which doesn't exist in the default responses in the AWS Gateway Response's list (and even if it did, that wouldn't help).
Seems this is just not possible?
This is not currently a feature of API Gateway. However, there is a workaround. Using Gateway Responses, you can override the 403 Missing Authentication Token response with a 404 and supply whatever message you want as a response.
Note, this only works when the API stage is valid:
So if your API is deployed to a stage named v1
https://{MyGatewayDomain}/api/v1/somepath
And the caller supplies the wrong stage
https://{MyGatewayDomain}/api/invalidStage/somepath
Then the API will still respond with 403 Forbidden

debug rest call in wso2 api manager

I am connecting rest api call with wso2 api manager. I followed the steps from wso2 site
I am able to connect with rest api on my computer but following same procedure on another computer returns "Error: No Response from Server"
I had also configured the files as described here
Does anybody knows how to debug what is going wrong there ?
You can enable wirelogs and headers in API Manager to analyze the request response flow.
Open log4j.properties file in /repository/conf directory.
Uncomment the following loggers.
log4j.logger.org.apache.synapse.transport.http.headers=DEBUG
log4j.logger.org.apache.synapse.transport.http.wire=DEBUG
Save the changes and Restart the Server
Invoke the API.
Regarding your "Error: No Response from Server" response, other than the CORS issue, this can occur due to browser certificate issue as well.
Therefore, first check whether you can invoke the same API using a rest client like curl,
if yes
go to your browser, accept the certificate for the gateway URL and try out invoking the API again.

Azure Cloud Services REST API - Get Package returning 404

Is this “Get Package” API still supported:
http://msdn.microsoft.com/en-us/library/windowsazure/jj154121.aspx
Seems like it always return HTTP 404.
I’m able to successfully use the “Get Deployment” API documented here:
http://msdn.microsoft.com/en-us/library/windowsazure/ee460804.aspx
But can’t get the /package resource to work. Note that I'm using the same certificate for authentication that I use for the "Get Deployment" API, and it works fine.
My call to the API looks exactly like in the MSDN documentation.
Is there any other way to retrieve the Service Package (.cspkg) file of a deployed cloud service?
The Get Package operation is still supported. It's likely that if you're getting a 404 response that you're using a HTTP GET method as opposed to POST. I've tested the operation using the REST Console plugin for Chrome and my package was successfully written to blob storage.
The URI used was:
https://management.core.windows.net/<subscription-id>/services/hostedservices/<cloudservice-name>/deploymentslots/<deployment-slot>/package?containerUri=<container-uri>