[API] pwg.getInfos returns a key "value" as Integer instead of String #1443

Open
opened 2026-10-05 00:44:04 +02:00 by adam · 0 comments
Owner

Since version 12.2.0, the pwg.getInfos method returns the following array:

{
    "stat":"ok",
    "result":{
        "infos": [{"name":"version","value":"11.5.0"},
                  {"name":"nb_elements","value":"339"},
                  {"name":"nb_categories","value":"28"},
                  {"name":"nb_virtual","value":"28"},
                  {"name":"nb_physical","value":"0"},
                  {"name":"nb_image_category","value":"348"},
                  {"name":"nb_tags","value":"11"},
                  {"name":"nb_image_tag","value":"33"},
                  {"name":"nb_users","value":"7"},
                  {"name":"nb_groups","value":"1"},
                  {"name":"nb_comments","value":"0"},
                  {"name":"first_date","value":"2017-08-31 22:44:11"}
                  {"name":"cache_size","value":4242}
        ]
    }
}

The added name and value pair (last of the list) contains a value of type Integer instead of String. This has broken the simple JSON decoding job in third party apps.

This new JSON data requires a much more complex decoder able to manage two different types for the same value key. It would have been much simpler to adopt the same String type. Can this be corrected?

Since version 12.2.0, the `pwg.getInfos` method returns the following array: ``` { "stat":"ok", "result":{ "infos": [{"name":"version","value":"11.5.0"}, {"name":"nb_elements","value":"339"}, {"name":"nb_categories","value":"28"}, {"name":"nb_virtual","value":"28"}, {"name":"nb_physical","value":"0"}, {"name":"nb_image_category","value":"348"}, {"name":"nb_tags","value":"11"}, {"name":"nb_image_tag","value":"33"}, {"name":"nb_users","value":"7"}, {"name":"nb_groups","value":"1"}, {"name":"nb_comments","value":"0"}, {"name":"first_date","value":"2017-08-31 22:44:11"} {"name":"cache_size","value":4242} ] } } ``` The added `name` and `value` pair (last of the list) contains a `value` of type Integer instead of String. This has broken the simple JSON decoding job in third party apps. This new JSON data requires a much more complex decoder able to manage two different types for the same `value` key. It would have been much simpler to adopt the same String type. Can this be corrected? <!-- github-sync-id:1198987779 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1443