API of Gofile *Help with HTTP Get and Post*

Hello everyone!! I want to make an app of this website. (I have the permission of the owner and the exclusivity :smiley::grinning_face_with_smiling_eyes:)
But I need help to use this API (Gofile - Free file sharing and storage platform)
Itā€™s on curl but I want to know how to use it on my app.
Thanks!!

1 Like

the api looks easy.Which is the request you want to implement in your app?

1 Like

All that are in the web. I need only an example of one type to understand the api

You can try use PHP CURL.

1 Like

How is it? Any extension?

You can as example try Upload file for example :wink:
Set request headers to make list- make list - item 1 : Content-Type item2 = multipart/form-data
Set url to https://{server}.gofile.io/uploadFile
Create a post request to build request data from a list that consists from 1 another list with two items.Item 1 = file item 2 = your file ( example from the website = @file.txt )
If i said some thing wrong you can correct me.:wink:


You will get response like that:
You will need to parse it to dictionaries using my extension here
And then you can use get block in the dictionaries to get any of the keys the json have like the token for example.An example of a response:
{ā€œstatusā€:ā€œokā€,ā€œdataā€:{ā€œcodeā€:ā€œ123Abcā€,ā€œadminCodeā€:ā€œ3ZcBq12nTgb4cbSwJVYYā€,ā€œfileNameā€:ā€œfile.txtā€}}

2 Likes

No. It is PHP Scripts with CURL Library or another language.

2 Likes

Web Component.

1 Like

Can you show me an example in blocks please? I donā€™t have a lot of experience on HTTP post and request :sweat_smile: @Mohamed_Tamer
How can execute the curl commands on my app? @Rogerio_Rios

With web component + PHP with CURL Library commands.
Look this API example in PHP CURL, This is an example of another API. You will have to adapt it ā€¦

 <?php
    $ch = curl_init();    
    curl_setopt($ch, CURLOPT_URL, "https://api.openrouteservice.org/v2/directions/driving-car");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);

    curl_setopt($ch, CURLOPT_POST, TRUE);

    curl_setopt($ch, CURLOPT_POSTFIELDS, '{"coordinates":[[8.681495,49.41461],[8.686507,49.41943],[8.687872,49.420318]]}');

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      "Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8",
      "Authorization: your-api-key",
      "Content-Type: application/json; charset=utf-8"
    ));

    $response = curl_exec($ch);
    curl_close($ch);

    var_dump($response);
?>
2 Likes

Hereā€™s an example:
image

1 Like

I get the error:
Error 1103
Unable to put the text file=logo.png with the specific URLā€¦

That isnā€™t a file.A file is something like that : @file.txt. Can you show me your blocks?
BTW, have you replaced the server word here:

With you sever.
Please show me you blocks :slightly_smiling_face:

Yes. I have replaced the server name. I havenā€™t put the @ before the asset name :sweat_smile:

You canā€™t upload assets as i think but iā€™m not sure :thinking: Also can you show you blocks?

So what type of files can I upload? (Iā€™ve tried with assets and I canā€™t)

Still isnā€™t working?BTW, the @ part is very important.And still.you canā€™t read files from assets.Try with files from storage.

It still not working with file of image picker


You just need the file name and not the full path.Something like
@file.png

What users need to learn and to understand how an API and the APIs they want to consume work, not the ready blocks. :+1:t2:

2 Likes