Skip to first unread message

borzack

unread,
Mar 15, 2016, 8:50:37 AM3/15/16
to MIT App Inventor Forum
Hello People,
I'm implementing a POST request where the response will include a Location HTTP header:

HTTP/1.1 200 OK
Location: https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&upload_id=xa298sd_f&part=snippet,status,contentDetails
Content-Length: 0

so the question is: how I can take Location field from the header using only web components?

Thanks in advanced



Taifun

unread,
Mar 15, 2016, 11:33:30 AM3/15/16
to MIT App Inventor Forum
how does an example response look like?
just extract the location information from the response, see the available text blocks here http://appinventor.mit.edu/explore/ai2/support/blocks/text.html

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

Taifun

Trying to push the limits of App Inventor! SnippetsTutorials and Extensions from Pura Vida Apps by  Taifun. 

borzack

unread,
Mar 15, 2016, 11:44:11 AM3/15/16
to mitappinv...@googlegroups.com
Hi Taifun,
I'm reading this page in order to upload a video on youtube:


in this page at Step 2 is wrote

If your request succeeds, the API server will respond with a 200 (OK) HTTP status code, and the response will include a Location HTTP header that specifies the URI for the resumable session. This is the URI that you will use to upload your video file.

The example below shows a sample API response to the request in step 1:

so my question is if I can use web component or not to implement a upload video file on youtube (web.got hasn't a Location field).



Taifun

unread,
Mar 15, 2016, 11:53:58 AM3/15/16
to MIT App Inventor Forum
probably yes, you will have to try it
my guess is, you will get the location in the responseContent of the Web.GotText event
Taifun

Domenico Borzack

unread,
Mar 15, 2016, 12:27:32 PM3/15/16
to MIT App Inventor Forum
But web.got give access to header?

Taifun

unread,
Mar 15, 2016, 1:58:31 PM3/15/16
to MIT App Inventor Forum
it has been said " the response will include a Location HTTP header
therefore my guess is, you will get the location in the responseContent of the Web.GotText event
just try something to find it out, see also tip 2 here
 

Top 5 Tips: How to learn App Inventor

Taifun

borzack

unread,
Mar 15, 2016, 2:21:14 PM3/15/16
to MIT App Inventor Forum

the responseContent is empty, also if responseCode=200, for this reason I've posted it.




Taifun

unread,
Mar 15, 2016, 4:10:09 PM3/15/16
to mitappinv...@googlegroups.com
which means, the web component currently is not able to receive that information

you might want to create your own web extension and add the response header as parameter in the web.gottext event

more information about how to create an extension see here https://groups.google.com/d/msg/mitappinventortest/Ip2AX036d0U/5NJlAEbFCgAJ
however that will be more advanced and will require some Java skills...
Reply all
Reply to author
Forward
0 new messages