Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Facebook Image Post Request

$
0
0

Hi guys, i´m implementing a Facebook Photo Request from ABAP, using fiddler I create this message that was succesfully posted in facebook page, now I´m trying to copy this post using if_http_client and if_http_entity multipart methods.

 

POST https://graph.facebook.com/767710622/photos?access_token=CAAUnJCRRhVUBAPFMl8p53wH8qfSuZAUZBo1IZCWJIoAGrZCB4Oo0GZC5vIrHd9DzMF7cZCUB9YONhY1SDW3tKCepWiqH9pxOeqnzuMmrzd6N4M2pbDDU7jZADyslPIRMfvsaPrNQXL4ZBxvp0dEZC5y83T5gPdad8EfyPWImv9h5COBEDC10cLvTB2fh9FZBAZACMs5XfpsK0xvLgZDZD HTTP/1.1
Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
User-Agent: Fiddler
Host: graph.facebook.com
Content-Length: 758192
---------------------------acebdf13572468
Content-Disposition: form-data; name="fieldNameHere"; filename="2012-Fiat-500-Abarth-Rear-Angle-Speed-Tilt-1920x1440.jpg"
Content-Type: image/jpeg
���� FExif��II*� ��� ��  � ���r ��   � ���� ��   � �������   � ��� ���   � �������   � �������   � ��� ���   � ��� ���   � �������   � �������(  � ��� ���1  � �������2  � ���  ��i� � ���  ��@ �� � � �Canon�Canon EOS 5D Mark II���-� '����-� '��Adobe Photoshop CS5 Windows�2011:11:18 03:02:40�� ��� � ���� ���� � ���� ��"� � ��� ���'� � ��������� � ���0230 � � ���� �� � � ���� �� �
� ���� �� � � ���� �� �
� ���� �� � � ���� �� � � ���� �� � � ��� ��� � � ��� ���
� � ���� ���� � ���81���� � ���81�� � � ��� ��� � � ���� �� � � ���� �� � � ���� �� � � ���� �� � � ��� ��� � � ������� � � ��� ��� � � ������� � � �������1� �
���� ��2� � ���  ��4� � ���

 

I already set the header fields Content-Type / Content-length but I´m having some issues trying to replicate the boundary in the body in line 08. Here is my code in ABAP that represents the line 08 to 10 + the content of the photo to upload.

 

lr_part = lr_client->request->if_http_entity~add_multipart( ).     CONCATENATE 'form-data; name="fieldNameHere"; filename="' iv_file_name '";' INTO lv_file_header.     CALL METHOD lr_part->set_header_field       EXPORTING         name  = 'content-disposition'         value = lv_file_header.     CALL METHOD lr_part->set_content_type       EXPORTING         content_type = 'image/jpeg'.     lv_len = XSTRLEN( iv_file_xstring ).     CALL METHOD lr_part->append_data       EXPORTING         data   = iv_file_xstring         length = lv_len.

 

The facebook response is : "(#324) Requires upload file"

 

Any help will be appreciated


Viewing all articles
Browse latest Browse all 8332

Trending Articles