cURL to blocks automatic generator

You can convert cURL command to AppInventor blocks hassle free

Convert curl to blocks by Getaix

Preiview

How to?

  • Copy & Paste curl text into the textbox
  • Hover over generated blocks and click download image
  • Drag and drop downloaded image to AppInventor workspace
  • Report bug if found

cURL to blocks by Getaix is inspired from CurlToBlocks by @HritikR .

CurlToBlocks by Getaix is still in beta and would like to know your reviews.

Thank you
Jerin Jacob

6 Likes

Nice work.

Just for my curiosity.....

I tried to convert this

curl -X POST https://www.oseamiya.tech/ -H "Authorization: Header" -H "Content-Type: application/json" -d "{"key" : "value"}"

This is the result from @HritikR his website

This is from yours

Can you tell why you added the posttext block in the end result?

1 Like

Thanks for checking it out.

This is the result I got when giving the curl input you mentioned

It is a post request as you can see in the curl text and also there is -d field which is data to send during post request.

Let me know if I'm wrong :sweat_smile:

Can you try real curl with -d field and test result from both website on AppInventor?

Thank You
Jerin Jacob

1 Like

Didn't check the code just copy and pasted it :grin: to look at the blocks generated.

1 Like

@Jerin_Jacob
I also got some strange results - I used the bug report google form...

1 Like

Thanks for informing and checking Getaix.

I checked the website mentioned in Google form and some curl in that.

If possible can you share the curl and generated image.

Thank you

Will anyone explain me what is CURL
I am fully confused on that

The above text is curl command, most of the API docs will have curl snippet for their API.

Check the website to see some examples and read the FAQ

2 Likes

Thank You @Jerin_Jacob

"BTW

I haven't understood it even now :sweat_smile::sweat_smile:

curl -d "client_id=<client_id>&scope=https://www.googleapis.com/auth/drive.file" https://oauth2.googleapis.com/device/code

the end of the scope url is missing

curl -d client_id=<client id> -d client_secret=<client secret> -d device_code=<device code> -d grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Adevice_code https://accounts.google.com/o/oauth2/token

> not set, and the url is wrong/missing

curl -X POST -L \
    -H "Authorization: Bearer <enter access token here>" \
    -F "metadata={name :'<our.zip>'};type=application/json;charset=UTF-8" \
    -F "file=@<our.zip>;type=application/zip" \
    "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart"

most of the metadata value is missing

2 Likes

First one is good , the scope url ends here

In Second one , you need to change the below values with real values , the <> makes it difficult to parse the curl

Third one I will look detailly.

Thank you for checking

I found if I put the key:pair items after each -d in quotes then it works...

curl -d "client_id=<client id>" -d "client_secret=<client secret>" -d "device_code=<device code>" -d "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Adevice_code" https://accounts.google.com/o/oauth2/token
2 Likes

curl is a command to execute a api in one statement this curl to blocks by jerin converts a curl command to ai2 blocks so that we know how do we do it in ai2 using curl.

2 Likes

Thanx @Aarush_Kumar Now i got it

1 Like

(added to FAQ)

2 Likes

@Jerin_Jacob great tool :slight_smile: , amazed to find -u working in your tool

Really worked ! :grin:

1 Like

@Jerin_Jacob

For the three cURL stanzas I provided, when in App Inventor, I found that the dictionaries did not work, the blocks had to be written out like this (nothing like the ones provided by the tool):

curl -d "client_id=<client_id>&scope=https://www.googleapis.com/auth/drive.file" https://oauth2.googleapis.com/device/code

curl -d client_id=<client id> -d client_secret=<client secret> -d device_code=<device code> -d grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Adevice_code https://accounts.google.com/o/oauth2/token

curl -X POST -L \
    -H "Authorization: Bearer <enter access token here>" \
    -F "metadata={name :'<our.zip>'};type=application/json;charset=UTF-8" \
    -F "file=@<our.zip>;type=application/zip" \
    "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart"

I guess it all depends on what you are cURLing :wink: It is certainly a useful tool to get started on the conversion.

5 Likes

very nice, to do a "curl" can not be used? (I've never been able to)
unfortunately the curl is installed in very few android, you probably all used virtualizers,i turned the web in all directions and couldn't figure out how to fix this. curl only works if it is installed on the device

Update 2022-03-21T18:30:00Z

- Curl to Blocks sharable links

image


Feedback and improvement

I'm excited :smiley: to know your feedback and feel free share your thoughts

Home | About | Feedback | Privacy Policy | Contact Us

Made with :heart:

Thank You
Jerin Jacob

4 Likes