/bin/aem/test.MY_SELECTOR.json is giving forbidden access message - aem

when appending .json at the end of the path to the sling servlet http://:/bin/aem/test.MY_SELECTOR.json or similar ajax call, I get 403 forbidden access error on the page.
however, if I use: http://:/bin/aem/test.MY_SELECTOR.now
or any other string after the (.)dot, it works without issues.
Only .json seems to be the issue.
Is there something blocking from ACS commons.

We need to convert jsonResponse, which is a String to Gson.toJson(jsonResponse)

Related

Why doesn't the encoded 'slash' work as expected in restful api?

I have a restful api request like this:
http://0.0.0.0:4000/sentence=SUITS/Test。
And it gives an error in browser:
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
Then I URL encoded the 'SUITS/Test。':
http://0.0.0.0:4000/sentence=SUITS%2FTest
This give the same error message.
If I remove the '/' from URL, and it works fine.
Why doesn't URL encoding work here?
This is python restful api with flask_restful.
If you provide "/" before Test it would consider "Test" as a resource and then in this case "sentence" should be considered as query param passed as GET payload after "?" like:
http://0.0.0.0:4000/Test?sentence=SUITS

How to fix Response body error '{"error":"invalid_scope","error_description":"Scope must be specified"}'

Our client has given us their end point and when we are try to hit their API we are getting below Error
'{"error":"invalid_scope","error_description":"Scope must be
specified"}'
It seems that your API is not getting hit properly.Use Postman to call the API and enter the proper parameter.If your API is correct and you are passing the correct parameter it will work.

Jmeter parameter without name in REST method

Hello i have GET method that URL example is:
http://localhost:8050/programs/b3cb6a0f-5d29-4744-a7e8-5fa0099dab18
Where the last String is just programId that I set as parameter in HTTP Request.
JMeter is kinda confused and the respond in raw request is:
GET http://localhost:8050/
GET data:
b3cb6a0f-5d29-4744-a7e8-5fa0099dab18
but there's just 404 in response data.
I can just delete parameter and write /programs/b3cb6a0f-5d29-4744-a7e8-5fa0099dab18 in path instead of /programs/ and everything works perfectly fine. IMO it's awful way. I'd prefer do it with parameter.
Write in path the parameter as /programs/${programId}.
This is part of the path and not parameter, parameters in GET request are different than POST see http methods
path/mypage?param1=value1&param2=value2

Confluence REST API Search - Error with encoding CQL query for HTTP GET

I am working with the following documentation to implement REST-based searching using Confluence CQL: https://developer.atlassian.com/confdev/confluence-rest-api/advanced-searching-using-cql and https://docs.atlassian.com/atlassian-confluence/REST/latest/#d3e648
I am able to do GET requests using the user id / password against other endpoints against my Confluence Cloud account. However, when I try to pass a CQL query to the search endpoint, as follows:
text ~ Tomcat
I get the following error:
{
"statusCode":400,
"data":
{"authorized":false,"valid":true,"errors":[]},
"message":"Could not parse cql : text %7E Tomcat"
}
Can anyone tell me what may be causing this? It looks like the CQL encoding for passing in HTTP GET is causing an error on the back end somehow. I am using Java to encode my GET parameters with UTF-8. This exact approach works just with with JIRA Cloud search using JIRA Query Language (JQL), so I'm confused what's going on here.
The endpoint I use is:
https://mycompany.atlassian.net/confluence/rest/api/content/search?
I have tried it with HTTPS and HTTP. I understand that for the search endpoint, a 400 response means "Returned if the CQL is invalid or missing" - any ideas what I'm missing here or what may be wrong with my CQL?
The authorization error is caused by you not being logged into your confluence instance...
Try logging in and use a url like this one (in some instances the confluence/ isn't needed)
https://mycompany.atlassian.net/confluence/rest/api/content/search?cql=space=DS

Zend_Uri_Http: Invalid URI supplied - even though url is valid

i have a url similar to this
http://one/two/three:four&five=six|seven
also i have
Zend_Uri_Http::setConfig(array('allow_unwise' => true));
in order to be able to use "|". when i try to use
Zend_Http_Client::setUri()
on my url, i get
Zend_Uri_Exception: Invalid URI supplied
when i hit the url from the browser, it works. how to avoid this problem. any ideas are welcome
The URL will be valid if you change it to:
http://one/two/three:four?five=six|seven
What is supposed to be the query string in that URI? You have to separate the query string from the path by ? before you can use & to separate arguments.
so it turns out i had a rewrite rule, defined in my httpd-vhosts.conf file, which created valid url after my invalid url was hit. since i needed to hit the url from within the zend framework phpunit test, i applied rewrite rule manually and got the correct url
moral of the story, put all the relevant info into your question, or else, nobody will be able to help you out