lightning-space

API

lightning-space comes with an API that you can use to integrate automated webhosting into your application. It's in heavy development.

Main API URL:
https://lightning-space.com/api/?type=9991

Create Hosting

Example request parameters:

tx_lightningspace_main[action] = createHosting
tx_lightningspace_main[controller] = API
tx_lightningspace_main[username] = randomusername
tx_lightningspace_main[password] = Randompassword
tx_lightningspace_main[space] = 100
tx_lightningspace_main[duration] = 1
tx_lightningspace_main[tocprivacy] = 1

Example Call:

https://lightning-space.com/api/?type=9991&tx_lightningspace_main%5Baction%5D=createHosting&tx_lightningspace_main%5Bcontroller%5D=API&tx_lightningspace_main%5Busername%5D=randomusername&tx_lightningspace_main%5Bpassword%5D=Randompassword&tx_lightningspace_main%5Bspace%5D=100&tx_lightningspace_main%5Bduration%5D=1&tx_lightningspace_main%tocprivacy%5D=1

You will receive a json response like this:

{
  "data": {
    "payreq": "lnbc2421710p1pws0rs2pp.................zsq208qls",
    "token": "09298d76c5a46d9fecf4.........69a259c43b4918410d7cbda944d6e",
    "msatoshi": "242171",
    "quoted_amount": 0.02,
    "quoted_currency": "EUR"
  },
  "status": {
    "code": 200
  }
}

Pay the invoice and use the Token to get the status of your payment as follows


Get payment status

Example request parameters:

tx_lightningspace_main[action] = getstatus
tx_lightningspace_main[controller] = API
tx_lightningspace_main[token] = 09298d76c5a46d9fecf4.........69a259c43b4918410d7cbda944d6e

Example Call:

https://lightning-space.com/api/?type=9991&tx_lightningspace_main%5Baction%5D=getstatus&tx_lightningspace_main%5Bcontroller%5D=API&tx_lightningspace_main%5Btoken%5D=09298d76c5a46d9fecf4.........69a259c43b4918410d7cbda944d6e

You will receive a json response like this after the payment is complete:

{
  "status": {
    "code": 200
  },
  "data": {
    "status": "paid"
  }
}

You can then get your hosting details by supplying username and password

 


Receive Hosting

Please supply username and password via HTTP Basic Authentication

Example request parameters:

tx_lightningspace_main[action] = getHosting
tx_lightningspace_main[controller] = API

Example Call:

https://lightning-space.com/api/?type=9991&tx_lightningspace_main%5Baction%5D=getHosting&tx_lightningspace_main%5Bcontroller%5D=API

You will receive a json response like this after the payment is complete:

{
  "data": {
    "domain": {
      "domain": "randomusername.lightning-space.com",
      "hd_quota": "100",
      "ssl_letsencrypt": "n",
      "rewrite_to_https": "n",
      "redirect_path": ""
    },
    "hosting": {
      "jobcount": 0,
      "enddate": 1560808799,
      "extension_token": "ead0cd8ec16e0cd0f2a0..9affc6fb6ef1ecd205ff4b68e"
    }
  }
}

When data.hosting.jobcount is 0 it's safe to connect to your webspace via HTTP/FTP/SSH.

You could use the extension_token to extend your space.

This API method is not complete yet.


Extend Hosting

Example request parameters:

tx_lightningspace_main[action] = extend
tx_lightningspace_main[controller] = API
tx_lightningspace_main[token] = ead0cd8ec16e0cd0f2a0e...fb6ef1ecd205ff4b68e
tx_lightningspace_main[duration] = 1

Example Call:

https://lightning-space.com/api/?type=9991&tx_lightningspace_main%5Baction%5D=extend&tx_lightningspace_main%5Bcontroller%5D=API&tx_lightningspace_main%5Btoken%5D=ead0cd8ec16e0cd0f2a0e...fb6ef1ecd205ff4b68e&tx_lightningspace_main%5Bduration%5D=1

You will receive a json response like this:

{
  "data": {
    "payreq": "lnbc2423270p1pws0xrnp...lu8gcdnl2qp6pldmk",
    "token": "a9cd69c842188c2...ef4615a12f580e",
    "msatoshi": "242327",
    "quoted_amount": 0.02,
    "quoted_currency": "EUR"
  },
  "status": {
    "code": 200
  }
}

Use the Get Payment Status API method with the returned token to observe the payment status.


Wallet - Create Invoice

Please supply username and password via HTTP Basic Authentication

Example request parameters:

tx_lightningspace_main[action] = createInvoice
tx_lightningspace_main[controller] = API
tx_lightningspace_main[amount] = 100

Example Call:

https://lightning-space.com/api/?type=9991&tx_lightningspace_main%5Baction%5D=createInvoice&tx_lightningspace_main%5Bcontroller%5D=API&tx_lightningspace_main%amount%5D=100

You will receive a json response like this:

{
  "add_index": "149",
  "pay_req": "lnbc1u1pw6tms7pp5e7smq5r2xum5up45shcw90l9m2g5z...6dtvqrc9ptrxmpw3uuzesqd9aphx",
  "payment_request": "lnbc1u1pw6tms7pp5e7smq5r2xum5...vqrc9ptrxmpw3uuzesqd9aphx"
}

Get Invoice Status

Please supply username and password via HTTP Basic Authentication

Example request parameters:

tx_lightningspace_main[action] = detailInvoice
tx_lightningspace_main[controller] = API
tx_lightningspace_main[req] = lnbc1u1pw6tms7pp5e7smq5r2xum5...dtvqrc9ptrxmpw3uuzesqd9aphx

Example Call:

https://lightning-space.com/api/?type=9991&tx_lightningspace_main%5Baction%5D=detailInvoice&tx_lightningspace_main%5Bcontroller%5D=API&tx_lightningspace_main%req%5D=lnbc1u1pw6tms7pp5e7smq5r2xum5...dtvqrc9ptrxmpw3uuzesqd9aphx

You will receive a json response

{
  "add_index": "149",
  "amt": 100,
  "description": "Lightning payment",
  "expire_time": 3600,
  "ispaid": false,
  "pay_req": "lnbc1u1pw6tms7pp5e7smq5r2xum5...dtvqrc9ptrxmpw3uuzesqd9aphx",
  "payment_request": "lnbc1u1pw6tms7pp5e7smq5r2xum5...dtvqrc9ptrxmpw3uuzesqd9aphx",
  "timestamp": 1571155486,
  "type": "user_invoice"
}