cURL to blocks automatic generator

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

Awesome @Jerin_Jacob!
I loved your work :slightly_smiling_face:

1 Like

Really Great Update :+1:

1 Like

not working for me i have a curl which run fine in online website which convert curl in response content but when i try this method i didnt get response
please help me

without knowing your curl statement, no body can help you.

All the key pairs with an -H, need to go in the responseHeaders list as lists of pairs, the rest in a normal GET URL.

Can you please show me blocks. How to arrange it

any error message?

this is the last step of my app please help me