$httpRequest

Perform an http request, with a content and headers and return the response content

Usage

$httpRequest[URL;Method;Content;Header 1;Header 2;...]

Methods:

Accepts PUT, GET, POST, DELETE, HEAD, PATCH methods, if not provided, it will use GET method

Content Input:

It can any content that suitable for your content-type header, like with content-type: application/json you can put the content as json format and so on

It accept the header in format of header: value
for example: Content-Type: application/json

Example (Sending JSON Request):

Member02/20/2024
!!exec $let[response;$httpRequest[My API URL;post;{"name":"Mido"};Content-Type: application/json]]
Response is $response
Response Status is $httpRequestStatus

Custom Command Bot 02/20/2024
Response is {"success":true}
Response Status is 200

Some Notes:

  • This function wont throw error if request non-ok status, so please check on your own the return value of $httpRequestStatus after the request to make sure its valid status you expecting
  • Make sure the response data length is less than 1 MB, or it will errorRandom