Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mediatype for api json format #1848

Closed
wants to merge 0 commits into from
Closed

Conversation

mingan666
Copy link

Fix #1847

Changes mediatype to application/json

@plegall
Copy link
Member

plegall commented Feb 11, 2023

Hi @mingan666

Thank you for this pull-request. Why don't we immediately merge it, as it seems so obvious it's the right fix? Because we don't want to break third party applications which would rely on the current text/plain mediatype.

Related to #1107 #406 or #448

The question is for me : how to make things right with application/json but not break old third party apps relying on text/plain? Then you understand why it's not as easy as it seems :-/

@plegall plegall closed this Feb 11, 2023
@plegall plegall reopened this Feb 11, 2023
@plegall
Copy link
Member

plegall commented Feb 11, 2023

(I closed this PR by mistake, sorry)

@mingan666
Copy link
Author

Thanks for the explanation.

I understand your concern, but at the same time the current bug is causing problems for 3th party libraries that are not able to recognize the response as json.
Would it be possible to add an additional query parameter requesting the proper mediatype?

Not that good at php so I'm not sure how to implement such a solution...

@mingan666
Copy link
Author

Quick look suggest it would be possible to add an additional format into include/ws_init.inc.php and tools/ws.htm.
As well as an additional class that could extend include/ws_protocols/json_encoder.php

Not the finast solution, but it gives users that want a correct mediatype that option, without breaking exiting integrations.
As I wrote above, not that good att php so I might be missing other parts that might need tweaking as well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Piwigo API returns wrong mediatype
2 participants