Page MenuHomePhabricator

API response size difference when removing detail and detailHTML

Authored By
Lucas_Werkmeister_WMDE
Nov 15 2017, 5:35 PM
Size
613 B
Referenced Files
None
Subscribers
None

API response size difference when removing detail and detailHTML

json=$(
curl -G \
-d 'format=json' \
-d 'formatversion=2' \
-d 'action=wbcheckconstraints' \
-d 'id=Q64' \
https://www.wikidata.org/w/api.php
)
withDetail=$(
printf '%s' "$json" |
jq -c . |
wc -c
)
withoutDetail=$(
printf '%s' "$json" |
jq -c '
del(
.. |
objects |
select(has("constraint")) |
.constraint |
(.detail, .detailHTML)
)
' |
wc -c
)
awk \
-v "withDetail=$withDetail" \
-v "withoutDetail=$withoutDetail" \
'END {
removed = withDetail-withoutDetail
printf "%2.2f%%\n", 100 * removed / withDetail
}' < /dev/null

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5094260
Default Alt Text
API response size difference when removing detail and detailHTML (613 B)

Event Timeline