Content type unacceptable. Content type "json" required #4039
Replies: 5 comments 10 replies
|
It is expecting both the Accept and the content-type: curl --request GET \
--url https://demo.lycheeorg.dev/api/v2/Photo::random \
--header 'Accept: application/json' \
--header 'Content-type: application/json'The double header is a result of the strictness of @nagmat84 :) When I do it I get: {
"message": "Session expired",
"exception": "SessionExpiredException"
}The scrictness can be disabled by setting in your REQUIRE_CONTENT_TYPE_ENABLED=falseI am looking into the Session expired issue. |
|
I upgrade to v7.3.2. I also added the missing I now have: Why not return an image that is publicly available? |
|
If I add the From https://xxx/Lychee/diagnostics I have From https://xxx/Lychee/gallery/starred I have starred pictures, not albums. I tried to get the list of public albums but with no success: |
|
If |
|
What are the impacts of using: The only goal is to prevent the use of the API from the documentation page? But why would I want that? I ask because with
const url = 'https://xxxx/Lychee/api/v2/Photo::random';
const options = {
method: 'GET',
headers: new Headers({
Accept: 'application/json',
"Content-Type": "application/json",
})
};
try {
const response = await fetch(url, options);
const data = await response.json();
[...]
It is a lot of pain, just for a documentation "issue". |
Uh oh!
There was an error while loading. Please reload this page.
Lychee version
v7.3.1
Did you check the latest Lychee version?
Yes, I did
Which PHP version are you using?
PHP 8.4
Detailed description of the problem
I would like to get a random image from my photo gallery.
I found
Photo::randomin https://demo.lycheeorg.dev/docs/api#/operations/frame.randomI was expecting to find it in Photo and not Frame part of the documentation.
The sample code for cURL is:
But I get:
I also tried the sample code for wget:
I get no error but no output:
Without
--quietI get:Steps to reproduce the issue
See above.
Diagnostics [REQUIRED]
not applicable
Browser & System [REQUIRED]
curl or wget
Please confirm (incomplete submissions will not be addressed)
All reactions