Closed hajanaone closed 7 months ago
Hi!
Correct, it's not JSON, it's binary JPEG format. You need to download and render it as is.
If you look at Content-Type
HTTP header you'll it's not application/json
but rather image/jpeg
.
We have an enhancement request about similar problem - https://github.com/devlikeapro/whatsapp-http-api/issues/177
With that there'll be two flag base64
and raw
which you can use to get
?format=base64
- base64 encoding of the JPEG QR image?format=raw
- the raw value of the QR, so you can generate your own custom QR code without parsing the existed one.?format=jpeg
- it's value by default, returns the binary imageThank you for flagging this, we'll prioritize the related task
Thanks for your reply. Please provide sample php code to echo qr code. It is difficult for me.
On Mon, 27 Nov 2023, 7:09 am Alex, @.***> wrote:
Hi! Correct, it's not JSON, it's binary JPEG format. You need to download and render it as is. If you look at Content-Type HTTP header you'll it's not application/json but rather image/jpeg.
We have an enhancement request about similar problem - #177 https://github.com/devlikeapro/whatsapp-http-api/issues/177
With that there'll be two flag base64 and raw which you can use to get
- ?format=base64 - base64 encoding of the JPEG QR image
- ?format=raw - the raw value of the QR, so you can generate your own custom QR code without parsing the existed one.
- ?format=jpeg - it's value by default, returns the binary image
Thank you for flagging this, we'll prioritize the related task
— Reply to this email directly, view it on GitHub https://github.com/devlikeapro/whatsapp-http-api/issues/237#issuecomment-1827019940, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNAWDNVEJD53EJGIX6ADPLYGPY53AVCNFSM6AAAAAA723KKPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRXGAYTSOJUGA . You are receiving this because you authored the thread.Message ID: @.***>
Sorry, I haven't worked with PHP for years... Last project was in 2016, I don't remember anything :)
You should ask either chatgpt or stackoverflow about that, they'll help faster and better!
Thank you so much 😊for your reply
On Mon, 27 Nov 2023, 10:45 am Alex, @.***> wrote:
Sorry, I haven't worked with PHP for years... Last project was in 2016, I don't remember anything :)
You should ask either chatgpt or stackoverflow about that, they'll help faster and better!
— Reply to this email directly, view it on GitHub https://github.com/devlikeapro/whatsapp-http-api/issues/237#issuecomment-1827159638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNAWDM2D5CQ6EVLE2BBHQDYGQSHPAVCNFSM6AAAAAA723KKPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRXGE2TSNRTHA . You are receiving this because you authored the thread.Message ID: @.***>
@hajanaone,
hello bro, catch the body raw and convert it to base64 (in php there is the base64_encode($str) function), once you have converted it print it img src="data:image/png;base64, data, this helped me
Hi! In 2023.12.1
release there'll be a way to get QR code in different formats.
https://waha.devlike.pro/docs/how-to/sessions/#get-screenshot
You can get QR in different formats:
GET /api/{session}/auth/qr
GET /api/{session}/auth/qr
and set Accept: application/json
headerGET /api/{session}/auth/qr?format=raw
Here's detailed information about each format:
# Get image - binary
GET /api/{session}/auth/qr
GET /api/{session}/auth/qr?format=image
GET /api/{session}/auth/qr?format=image Accept: image/png
2. **base64 image** - you'll get image in base64 format in response if you set `Accept: application/json` header.
```bash
GET /api/{session}/auth/qr?format=image
Accept: application/json
{
"mimetype": "image/png",
"data": "base64-encoded-data"
}
You can change it in Swagger by clicking on Media Type dropdown and selecting application/json:
GET /api/{session}/auth/qr?format=raw
{
"value": "value-that-you-need-to-use-to-generate-qr-code"
}
Thanks. It is really appreciated 👍
On Thu, 30 Nov 2023, 4:06 pm Alex, @.***> wrote:
Hi! In 2023.12.1 release there'll be a way to get QR code in different formats.
https://waha.devlike.pro/docs/how-to/sessions/#get-screenshot
QR formats
You can get QR in different formats:
- binary image - GET /api/{session}/auth/qr
- base64 image - GET /api/{session}/auth/qr and set Accept: application/json header
- raw - GET /api/{session}/auth/qr?format=raw
Here's detailed information about each format:
- binary image, binary image - default format, you'll get image in response
Get image - binary
GET /api/{session}/auth/qr
OR
GET /api/{session}/auth/qr?format=image
OR specify Accept header as well
GET /api/{session}/auth/qr?format=image Accept: image/png
- base64 image - you'll get image in base64 format in response if you set Accept: application/json header.
GET /api/{session}/auth/qr?format=image Accept: application/json
{ "mimetype": "image/png", "data": "base64-encoded-data" }
You can change it in Swagger by clicking on Media Type dropdown and selecting application/json:
- raw - you'll get raw data in response, you can use it to generate QR code on your side
GET /api/{session}/auth/qr?format=raw
{ "value": "value-that-you-need-to-use-to-generate-qr-code" }
— Reply to this email directly, view it on GitHub https://github.com/devlikeapro/whatsapp-http-api/issues/237#issuecomment-1833544396, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNAWDMK73ZDU2LFZDU2NS3YHBSEBAVCNFSM6AAAAAA723KKPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZTGU2DIMZZGY . You are receiving this because you were mentioned.Message ID: @.***>
Hi I am running QR API in my PHP Project. Its not giving me image url for QR Code, Kindly help me how it will return an Image of QR Code.
I am Just getting response some thing like this.
�PNG
IHDR�p�yIDATx�~�CIDAT��A��ʒ�@R����e� T�������ֺ�a��.yXk�K�Z뒇�ֺ�a��.yXk�K�Z뒇�ֺ�a��.yXk�K�Z뒇�ֺ�a��.yXk�K�Z�>R���P��P9��T��I半ߤ�EŤ2U��2U���Q��Iʼn�IŤ�7U|��Z�<���%k�u��Uܤ�/S9Q�&��bR�NT~S�IŤ2U�TLoT���T��nR��a��.yXk�K�Z�~��o�L'SŤrR1���2ULS���T1���2U|��Fʼn�T1UL'''�I半����Z�<���%k�u��cT~��IŤ2ULSŤ2U��L��o����TLoT��L��T1�LoTL�K�Z뒇�ֺ�a��.��L�o�LS�I�I�M�ʉ���IŤr�2ULSʼn���S�����ֺ�a��.yXk�K~�e��7&��bR�Be��T���7�P�T��IeR��P�&������bR�n���<���%k�u��Zk]��e���bR�&��bR�&��bR�&��bR�&��bR9Q�N&��bR9Q����T���Ie�8Q��=���%k�u��Zk]��G�������Ie��T��Ie�8��T��Ie��Tި��bR�nR�N&�7&��bRy������ֺ�a��.yXk�K~�He��Tn��NTN&�/NNT����7�ܤr�2U��L�ʉ�TqR1��TL''7U����ֺ�a��.yXk�K�.R���De�8Q��&�7�Py��D半7TN&��bR9��MS�'��7=���%k�u��Zk]b���IŤ2UL''S�SŤ2ULSʼnʿ��D半���D�bR9�8Qy��De�8Q��⋇�ֺ�a��.yXk�K~��bR�&���De��&�����I����bR�&�7&��7��8Q9��Ie�xCe��&�����Zk]��Z�<���%��L��IŤ�FŤ�7U���F�'��Tq�rS�ߤ�E�oT�K�Z뒇�ֺ�a��.�?�@e�xCe�8Q�&���I勊7TN&���I半/TN&��bR��P��� ���7Tn��T����Z뒇�ֺ�a��.�?�@半I勊I�� �7NTNNTNNTި�B�bRy�2ULS�oT��2U|��Z�<���%k�u����Ie��T�P�nR�N���TNNT&���De��T&����T��Ie�8�8���bRyC�7=���%k�u��Zk]b���T1��T���TL''SŤ2U��L����I�oRy�bR���&���I��D�bR�&�/�xXk�K�Z뒇�ֺ���?�2U�MSʼn�T��Tq��EŤ2U���T���F�oT���FŤ2ULoTL*SŤ2U����Z�<���%k�u��L�����⍊��⋊��� ��T���bR�&���7NT�����T1�L'SŤ2U|��Z�<���%k�u��L勊I�bR�Tn���Py�bR������I勊���M''_T��L7=���%k�u��Zk]b����bR�&�����&���7TN&��bR�NTN�K'��T��T1�L��T�7=���%k�u��Zk]b���I�SŤ2UL_TL'��T1��Q��Tq�rR�TNNT��I�� ��bR��P9��TN&��⦇�ֺ�a��.yXk�K�>P9��T���TN&���Ie��Tި��Le��Be��T��I�bRy����bR�NT����bR��xXk�K�Z뒇�ֺ䇿�⦊I半7TN&�7TNNTި�T���bR9�8�8��TN&���I�D�b��T��I�⍊I�7=���%k�u��Zk]b���T1��T��|Q�TN&���I勊/T��/Tި�T��I半7T���T���Be���a��.yXk�K�Z�>�8��TNT����bR�����&���De��T�P�ި8�8��T��I��⋊��bR�NT����Z뒇�ֺ�a��.�?�@e��TNNT��/TN&���D�bR�NTި8Q�&�7�P�NT���T��I勊I�bR9�8Q9���a��.yXk�K�Z�~YŤr�2ULoTL�ʤ2ULS�Tq���T1���LSŤrR1��T1�L'��'���bRy�bR��a��.yXk�K�Z�>��B�D半���Ie�xCe�����7TNTN&���De��T�P��bR�NT�P�����ֺ�a��.yXk�K~�H半Ie�xC半IeR���8Q9��T��8�xCe�8Q9Q�NTn��Be�x�� ������Z�<���%k�u��8���De��TN&��bR�&��� ��bR�nR�NTި8Q9�xCeR�MS�Sʼn��a��.yXk�K�Z����T��I�� ������Ie��Tn�xC勊7TNnR��&��bR��� ��� ��⋇�ֺ�a��.yXk�K�>P�NT�?��T��I�bR�&�7&�YŤ2U���Tܤ�FŤrS�S�k�u��Zk]��Z��\�2U���TLSŤ2U���E�7ULSŤ2ULoT|�2UL7Uܤ2ULSŤ�F�'_<���%k�u��Zk]����D�De�����xCe�8��TNTN�P��P��bR�NTN&��bR�B��ozXk�K�Z뒇�ֺ����L_��Tq�rR1��TL''TLoT|�rR1�L'S�'7�L��T��Tq��Zk]��Z�<���%?\�2UL'��T1�L��T�FŤ2��&���Ie��TnR��bR9��T�P9�8��TN&�����Ie�xCe���a��.yXk�K�Z�>R�Ie��T��Ie��T����bR�~SŤ2U��2U��L���ʤ2UL7U��2ULS�����Z�<���%k�u���oT���K�P9��T�����bRy�bR��P�&�7&�Iʼn�T1�L7=���%k�u��Zk]��G��T1��Q1�L'SŤ2U��L'''SŤ2ULSŤ�E�M*����7Tި�TNT����Ie���a��.yXk�K�Z�~��SŤ2UL��o�L��T�ʉ�T1�LSŤ2UL''��Tq�2U�Qq�2U��T����a��.yXk�K�Z����Ie��B��De��T������7T��/T��I� ���D�&����&��bRy�bR��%k�u��Zk]��Z����oRy�bR�TN&�7&���D��De��TNTި8Q9���� �7��I���T����ֺ�a��.yXk�K�.R�&������ �/&���I半Ie�xCe�8Q9�8Q��bR9��TN&���Ie�8Q�&��bR�NT����Z뒇�ֺ�a��.��#��bR9�8QyC�bR�NT����bR��P�NNT�P��bR�T��/&���Ie��TN&��� ��b��Mk�u��Zk]��Z���Q�''_T��L'oTLS���bR�&���I��De�x�bRyCe�8QyCe�xCe���a��.yXk�K�Z���Tި8Q���De�xCe��Be��Tި�T��7T��8Q��P�&��bR9��TNNT���7&�7�xXk�K�Z뒇�ֺ�L�ߤ2UL_��T�Qq�2U���Qq�2��T|QqS�IŤ�Fʼn�T1�L'��ozXk�K�Z뒇�ֺ�����T���TL_TLoT���TL'��Tq�2UL_T���Qq��Fʼn���I�MSʼn�T���Zk]��Z�<���%?|��n��TNNT&�7�P9Q���I�bR�NTި�T��7&��b��TNT����bR9�xC�7=���%k�u��Zk]b��Tn��B�bR��P9�xCe��T���T��I半I妊Ie��T��I��De��TN&���xXk�K�Z뒇�ֺ����7&���D�o��B�bR��P�NT��Ie�8Q��P�&��2UL_T���Z�<���%k�u���T������7NTn�xC�7U��|Qq��F�'���bR9���a��.yXk�K�Z�>��M'SŤ2ULS�I�M'SŤrS�oT��&���bR9��TN�Py��7=���%k�u��Zk]��GS�T1�L�ʉ�T1�L'Sʼn�T�F�'S�oRy��� �7&���I�De�8��Tި��a��.yXk�K�Z�.��I�D半I�De��T����&����7�Py�bR�N&���7T&���D半/&��⦇�ֺ�a��.yXk�K~�eoTܤrRq���YŤr���IŤ2�L��T1��T��L��*S�T1�L<���%k�u��Zk]�����ߤr�2U�/�xC�����b��Be���P��ek�u��Zk]��Z���?F�o�8Q9��N&����D�⋊IeRy�b��T�����ߤ2ULSŤrR��Z뒇�ֺ�a��.��U���I�bRy�bR9��TNT����Ie��I半��I��De��T���� �����bRy�����Z�<���%k�u����MSʼn�Tq�2�LoT�TLoT�T1�L�ʤ�7UL_��Q��Tq��/yXk�K�Z뒇�ֺ��
��.xXk�K�Z뒇�ֺ�a��.yXk�K�Z뒇�ֺ�a��.yXk�K�Z뒇�ֺ�a��.yXk�K�Z뒇�ֺ���3�+��4fIEND�B
�