BlocosIA Wiki Editor

Web and JSON

Request data from internet APIs (HTTPS), get the answer in an event and read JSON safely.

Only https:// addresses of public sites. The first time a project reaches a site, you choose whether to allow it. No cookies and no account data; up to 2 MB per answer, 15 s timeout and 60 requests per minute. Build the body with "object with" and "list with" (no typing JSON) and read the answer with "response data" + "value … of". Paths: data.list[0].name (in paths the first item is [0]).

To use it: in the editor, click "Extensions" (bottom corner) and add "Web and JSON".

Stack

[GET] request to ( ) with body ( ) named ( ) and wait

Makes an HTTPS request and waits for the answer (up to 15 s) before continuing.

Stack

[GET] request to ( ) with body ( ) named ( )

Makes an HTTPS request and continues right away; the answer arrives in "when the response of … arrives". The body can be an object.

Reporter

address ( ) with parameters ( )

Builds the address with the parameters of an object (?city=…&days=7), already encoded.

Hat

when the answer to [pedido1] arrives

Starts a script when this happens.

Hat

when request [pedido1] fails

Starts a script when this happens.

Reporter

response data of ( )

The answer already converted: object or list when the site answers JSON.

Reporter

answer of ( )

Gives a number or text. Put it inside a round slot.

Reporter

status code of ( )

Gives a number or text. Put it inside a round slot.

Boolean

request ( ) succeeded?

Answers true or false. Use it in "if", "repeat until" and "wait until".

Reporter

error of ( )

Gives a number or text. Put it inside a round slot.

Boolean

waiting for the answer to ( ) ?

Answers true or false. Use it in "if", "repeat until" and "wait until".

Stack

use header ( ) with value ( )

Does an action. Snap it below another block.

Stack

clear headers

Does an action. Snap it below another block.

Reporter

encode ( ) for a web address

Gives a number or text. Put it inside a round slot.

Reporter

object with [name] : ( ) , [score] : ( )

Creates an object with keys and values, without typing JSON. Use + and − to change the number of pairs.

Reporter

value ( ) of ( )

Reads a value from an object or list by path: data.list[0].name (in paths the first item is [0]). Returns numbers, texts, lists or objects.

Reporter

( ) with ( ) = ( )

A copy of the object with the value changed (creates the path if needed).

Stack

in object [score] set ( ) to ( )

Changes a value inside the object stored in the variable.

Reporter

( ) without ( )

A copy of the object without that key.

Boolean

( ) has ( ) ?

True if the path exists in the object.

Reporter

keys of ( )

The list of the object's keys.

Reporter

values of ( )

The list of the object's values.

Reporter

read JSON text ( )

Turns a JSON text into a real object or list.

Reporter

convert ( ) to JSON text [compact]

Turns an object or list into JSON text (compact or formatted).

Boolean

( ) is valid JSON?

True if the value is an object/list or a valid JSON text.