1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Addon Reqn 1.2.1

Properly implemented web requests for Skript

  1. btk5h
    Supported Minecraft Versions:
    • 1.7, 1.8, 1.9, 1.10, 1.11
    Reqn is an HTTP request library for Skript 2.X.

    Documentation/Source - Releases

    Quickstart
    Code (Skript):
    1. # Send a get request to a url. The protocol (http or https) is required.
    2. send a request to "http://example.com"
    3.  
    4. # Send a request using a different HTTP method.
    5. send a "put" request to "http://example.com"
    6.  
    7. # Send a request with headers and a body. They are both optional.
    8. send a "post" request to "http://example.com" with the headers "Authorization: Token", and "Content-Type: application/json" and the body "{""body"":""don't forget to escape your quotes!""}"
    9.  
    10. # They can be in any order, too.
    11. send a "post" request to "http://example.com" with the body "{""body"":""don't forget to escape your quotes!""}" and the headers "Authorization: Token", and "Content-Type: application/json"
    12.  
    13. # Access the last response.
    14. set {_resp} to the last http response
    15.  
    16. # Access the response code
    17. set {_code} to {_resp}'s status code
    18.  
    19. # Access the headers of a response.
    20. set {_headers::*} to {_resp}'s headers
    21.  
    22. # Or just a specific header. Capitalization matters with header names.
    23. set {_length} to {_resp}'s "Content-Length" header
    24.  
    25. # Access the body of a response.
    26. set {_body} to {_resp}'s body
    More features (such as JSON escaping) and additional syntax can be found in the documentation.

    FAQ
    Will requests cause my server to freeze?
    No. Unlike skQuery's text from url, processing is done on a separate thread. This also delays the event, meaning you can't set event values after making a request.

    Will last HTTP response change if multiple requests complete at the same time?
    As long as you retrieve the last HTTP response immediately after making the request (without waiting), there is no chance of responses being mixed up. It's good practice to save the response to a variable immediately and using the variable instead if you intend on using the last HTTP response.

    Can I accept compressed content?
    Yes. Content compressed with GZIP or DEFLATE will be properly decompressed. Be sure to add "Accept-Encoding: gzip" to the request header to notify the web server that you are accepting compressed content.

    How do I handle JSON output from a Web API?
    The addon skript-json was written specifically for this purpose. It converts JSON structures into plain Skript list variables for easy consumption. As an added bonus, skript-json will convert list variables into JSON if you need to send JSON to a Web API.

Recent Updates

  1. Reqn 1.2.1
  2. Reqn v1.2.0

Recent Reviews

  1. CrazyWords
    CrazyWords
    5/5,
    Version: 1.2.1
    Awesome addon, and awesome developer, can you add a proxy support? (This is very need, for use api with limits)
  2. Biscuit
    Biscuit
    5/5,
    Version: 1.2.0
    Great, lots of complex features! Would recommend :)