Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

HTTP POST with extendScript

Participant ,
Sep 20, 2019 Sep 20, 2019

Hi friends,

 

I wonder is there a way to upload an HTTP post to my server using extendScript?
And if so, is it also possible to upload a file (mp3 or mp4) to my server using the same method or do other tools like CURL have to be used?

Thank you

TOPICS
Scripting
3.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 21, 2019 Sep 21, 2019

You can use the built-in Socket object in After Effects, but it's pretty complicated with hardly any documentation. Check out this library for making HTTP requests:

 

https://github.com/buraktamturk/adobe-javascript-http-client

 

Once you've included that library, making HTTP requests are pretty straightforward:

 

var data = $http({

   method: 'GET',

   url: 'example.com/',

   headers: {'Accept': 'application/json','Content-Type': 'application/json'} });

alert(data.payload);

 

Look into post requests for uploading files.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 22, 2019 Sep 22, 2019

Thanks for your answer! I now this library. And I know that you can upload text with the POST request, but i wonder it it pasible also to upload files?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 26, 2019 Sep 26, 2019

I haven't done it myself, but it should be possible. This article should help:

 

https://developer.mozilla.org/en-US/docs/Archive/Mozilla/XUL/FileGuide/FileUpDown

 

If not, you might want to look into streaming data with WebSockets.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 16, 2021 Mar 16, 2021
LATEST

I'm trying to send a post request with this library but it's not working with no errors. any updates for 2021?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines