How to connect random org to a website?

I want to connect a script for generating numbers to my site random org. They have a description of the API on their site, but I can't figure out how it works. Maybe someone can explain how it works. Thank you in advance

Author: Daniil Dubchenko, 2017-06-13

1 answers

  1. You need to get the key to access the API
  2. After that, you must make a POST request to the address https://api.random.org/json-rpc/1/invoke with the header content-type: application/json and pass the JSON object

    {
        "jsonrpc": "2.0",
        "method": "generateIntegers",
        "params": {
            "apiKey": "ваш ключ",
            "n": 10,
            "min": 1,
            "max": 123456789,
            "replacement": true
        },
        "id": 3
    }
    

    Where:

    • method - the method you want to execute
    • apiKey - your key
    • id - unique identifier of the request and response
    • params - parameters for the method (they may differ for different methods)

    And in return you will get

    {
        "jsonrpc": "2.0",
        "result": {
            "random": {
                "data": [
                    47209387,
                    29112205,
                    67652257,
                    25567818,
                    74065963,
                    19777276,
                    45858504,
                    122833666,
                    11524610,
                    10283904
                ],
                "completionTime": "2017-06-13 14:29:04Z"
            },
            "bitsUsed": 269,
            "bitsLeft": 249725,
            "requestsLeft": 997,
            "advisoryDelay": 180
        },
        "id": 3
    }
    
 1
Author: Mikhail Vaysman, 2017-06-13 14:39:33