Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/http/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["http","json"], { url: "<url>" });
console.log(JSON.stringify(result));From the command line
$ mark http json --url <string>
As data, in a program
{ "$proc": ["http", "json"], "input": { "url": "<url>" } }JSON Schemas
{
"input": {
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "The URL: http: or https:"
},
"method": {
"description": "GET or POST (default: POST with json, GET without it)",
"type": "string",
"enum": [
"GET",
"POST"
]
},
"headers": {
"description": "The headers of the request",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
}
},
"query": {
"description": "More parameters for the query of the URL. A list gives the parameter more than one time",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": [
"string",
"number",
"boolean"
]
},
{
"type": "array",
"items": {
"type": [
"string",
"number",
"boolean"
]
}
}
]
}
},
"json": {
"description": "The JSON body of a POST"
},
"timeoutMs": {
"description": "The time of the whole call, in milliseconds (default: 30000)",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 86400000
},
"maxResponseBytes": {
"description": "The largest body of the response, in bytes. The default and the maximum is the limit of the module (10 MiB)",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"failOnStatus": {
"description": "True (default): a status outside 200 to 299 is an error. False: the output has the status",
"type": "boolean"
}
},
"required": [
"url"
]
},
"output": {
"type": "object",
"properties": {
"status": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The status of the response"
},
"ok": {
"type": "boolean",
"description": "True for a status in 200 to 299"
},
"url": {
"type": "string",
"description": "The URL of the response: the last URL after the redirects"
},
"headers": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"description": "The headers of the response, with names in lowercase"
},
"data": {
"description": "The parsed body. An empty body gives null. An error status with a body that is not JSON gives its text"
}
},
"required": [
"status",
"ok",
"url",
"headers",
"data"
],
"additionalProperties": false
}
}