RESTful API

Lexset offers endpoints for creating, starting, stopping, and modifying your simulation.

Create Simulation

POST https://lexsetapi.lexset.ai/api/Simulations/NewSimulation

Create a simulation

Headers

NameTypeDescription

Authorization

string

Bearer token

{
    "datasetname": null,
    "datasetdescription": null,
    "imagecount": 1000,
    "datasetid": 442,
    "configfile": null,
    "id": 430,
    "userid": 3,
    "simulationconfig": "",
    "randomseed": 1.0,
    "isComplete": false,
    "timestamp": "2021-05-21T16:23:57.3008995+00:00",
    "datasets": [
        {
            "id": 442,
            "userid": 3,
            "name": null,
            "description": null,
            "url": null,
            "storageLocation": null,
            "imageCount": 1000,
            "client": null,
            "simulationId": 430
        }
    ],
    "renderJobs": null
}

Body (raw - JSON)

{
  "id": 0,
  "userid": <YOUR USER ID>,
  "simulationconfig": <BASE64 ENCODING OF SIMULATION CONFIG>,
  "randomseed": 1,
  "renderjobid": 0,
  "imagecount": 1000
}

Python Requests

import requests
import json

url = "https://lexsetapi.lexset.ai/api/Simulations/NewSimulation"

payload = json.dumps({
  "id": 0,
  "userid": <YOUR USER ID>,
  "simulationconfig": <BASE64 ENCODING OF SIMULATION CONFIG>,
  "randomseed": 1,
  "renderjobid": 0,
  "imagecount": <THE NUMBER OF IMAGES YOU WANT>
})
headers = {
  'Authorization': <YOUR TOKEN>,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

cURL

curl --location --request POST 'https://lexsetapi.lexset.ai/api/Simulations/NewSimulation' \
--header 'Authorization: Bearer <YOUR TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": 0,
    "userid": <YOUR USER ID>,
    "simulationconfig": <BASE64 ENCODING OF SIMULATION CONFIG>,
    "randomseed": 1,
    "renderjobid": 0,
    "imagecount": <THE NUMBER OF IMAGES YOU WANT>
}'

Start Simulation

POST https://lexsetapi.lexset.ai/api/Simulations/StartSimulation

Once you create your simulation you can start the simulation.

Path Parameters

NameTypeDescription

id

number

ID of your simulation

Headers

NameTypeDescription

Authentication

string

Bearer Token

Python Requests

import requests

url = "https://lexsetapi.lexset.ai/api/Simulations/StartSimulation?id=401"

payload={}
headers = {
  'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkYzVDZUNVFMdTF2bFZrb2NzUVdfOSJ9.eyJpc3MiOiJodHRwczovL2xleHNldC51cy5hdXRoMC5jb20vIiwic3ViIjoibEI1cjNad0JhZjBSc3ZZUVU0RXpCeFpadHBURDM1OGlAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbGV4c2V0LnVzLmF1dGgwLmNvbS9hcGkvdjIvIiwiaWF0IjoxNjE5MDIxOTk3LCJleHAiOjE2MjE2MTM5OTcsImF6cCI6ImxCNXIzWndCYWYwUnN2WVFVNEV6QnhaWnRwVEQzNThpIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.qXo_cuFd-Fp6yCXz1MXMgKXVo8_dI0yvmsPdANz849873k3rL75XLjDTA4-hCvPLiadUenSWicEBMiAVq3qAY1r_OpiGRNPLiWhxeL1Jk-QHYBWmMbDZPyZPV_sSsihO59yplIJJAfFnINYPyUH_ty_WM64eENSCh_Rg_GcXLop9BKXhSlTSPjwF3Skzkzl9bbSzhunHslV9RoKvrkscAY0JBFcv6ZCI2H74vY6TWak-zyOEA2ZO2wq0_5FLygg5cx3_PYC_JN6m1Iwi9Odkl6EVl_BeZFdh2gZHKyTCvB9ys2K3Kb09Y_k33H4XQSDQK8rGu8EGuRxJrI2tlf_9Dw'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

cURL

curl --location --request POST 'https://lexsetapi.lexset.ai/api/Simulations/StartSimulation?id=401' \
--header 'Authorization: Bearer <YOUR TOKEN>'

Stop Simulation

POST https://lexsetapi.lexset.ai/api/simulations/stopsimulation

Once your simulation has started you can then stop it early if necessary

Path Parameters

NameTypeDescription

id

string

ID of your simulation

Headers

NameTypeDescription

Authentication

string

Bear Token

Python Requests

import requests

url = "https://lexsetapi.lexset.ai/api/simulations/stopsimulation?id=<YOUR SIMULATION ID>"

payload={}
headers = {
  'Authorization': 'Bearer <YOUR TOKEN>'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

cURL

l --location --request GET 'https://lexsetapi.lexset.ai/api/simulations/stopsimulation?id=<YOUR SIMULATION ID>' \
--header 'Authorization: Bearer <YOUR TOKEN>'

Check Status

GET https://lexsetapi.lexset.ai/api/simulations/getsimulationstatus

This endpoint allows you to get free cakes.

Path Parameters

NameTypeDescription

id

number

ID of your simulation

Headers

NameTypeDescription

Authentication

string

Bearer token

{   
    "datasetname": null,
    "datasetdescription": null,
    "imagecount": 0,
    "datasetid": 0,
    "configfile": null,
    "id": 305,
    "userid": 3,
    "simulationconfig": <YOUR SIMULATOIN CONFIG IN BASE64 ENCODING>,
    "randomseed": 1.0,
    "isComplete": true,
    "timestamp": "2021-04-29T10:21:46",
    "datasets": [
        {
            "id": 320,
            "userid": 3,
            "name": null,
            "description": null,
            "url": null,
            "storageLocation": null,
            "imageCount": 12,
            "client": null,
            "simulationId": 305
        }
    ],
    "renderJobs": null
}

Python - Requests

import requests

url = "https://lexsetapi.lexset.ai/api/simulations/getsimulationstatus?id=<YOUR SIMULATION ID>"

payload={}
headers = {
  'Authorization': 'Bearer <YOUR TOKEN>'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

cURL

curl --location --request GET 'https://lexsetapi.lexset.ai/api/simulations/getsimulationstatus?id=<YOUR SIMULATION ID>' \
--header 'Authorization: Bearer <YOUR TOKEN>'

Get Dataset Items

GET https://lexsetapi.lexset.ai/api/datasetitems/getdatasetitems

Retreive a list of data points that have been generated by your simulation

Path Parameters

NameTypeDescription

dataset_id

number

ID for the dataset being generated

Headers

NameTypeDescription

Authorization

string

Bearer Token

[
    {
        "id": 7888,
        "renderjobid": 269,
        "datasetid": 303,
        "renderType": "rgb",
        "filename": "e3c7fb5e-3ab6-4b28-ad6c-811d16a12c01.rgb_0001.png",
        "width": 1920,
        "height": 1080,
        "dateCreated": "04 23 2021 14:53:06",
        "failed": false,
        "endTime": "2021-04-23T14:55:24",
        "startTime": "2021-04-23T14:53:06"
    },
    {
        "id": 7889,
        "renderjobid": 269,
        "datasetid": 303,
        "renderType": "rgb",
        "filename": "44ed74ed-fd60-439b-8dbb-ccf46f7cfa9f.rgb_0001.png",
        "width": 1920,
        "height": 1080,
        "dateCreated": "04 23 2021 14:53:14",
        "failed": false,
        "endTime": "2021-04-23T14:55:30",
        "startTime": "2021-04-23T14:53:14"
    },
    {
        "id": 7890,
        "renderjobid": 269,
        "datasetid": 303,
        "renderType": "seg",
        "filename": "e3c7fb5e-3ab6-4b28-ad6c-811d16a12c01.seg_0001.exr",
        "width": 1920,
        "height": 1080,
        "dateCreated": "04 23 2021 14:55:26",
        "failed": false,
        "endTime": "2021-04-23T14:55:43",
        "startTime": "2021-04-23T14:55:26"
    }
]

Python Requests

import requests

url = "https://lexsetapi.lexset.ai/api/datasetitems/getdatasetitems?dataset_id=<YOUR DATASET ID>"

payload={}
headers = {
  'Authorization': 'Bearer <YOUR TOKEN>'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

cURL

curl --location --request GET 'https://lexsetapi.lexset.ai/api/datasetitems/getdatasetitems?dataset_id=<YOUR DATASET ID>' \
--header 'Authorization: Bearer <YOUR TOKEN>'

Download Data

GET https://lexsetapi.lexset.ai/api/datasets/getdatasetarchives

Once your simulation is complete, you can download your dataset

Path Parameters

NameTypeDescription

dataset_id

string

The ID of your dataset

Headers

NameTypeDescription

Authorization

string

Bearer Token

[
    {
        "id": 21,
        "datasetId": <ID OF YOUR DATASET>,
        "filename": "dataset.zip",
        "url": "<DATASET PATH>",
        "isComplete": true
    }
]

Python Requests

import requests

url = "https://lexsetapi.lexset.ai/api/datasets/getdatasetarchives?dataset_id=<YOUR DATASET ID>"

payload={}
headers = {
  'Authorization': 'Bearer <YOUR TOKEN>'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

cURL

curl --location --request GET 'https://lexsetapi.lexset.ai/api/datasets/getdatasetarchives?dataset_id=<YOUR DATASET ID>' \
--header 'Authorization: Bearer <YOUR TOKEN>'

Get Active Simulations

GET https://lexsetapi.lexset.ai/apisimulations/GetActiveSimulations/

Get a list of all the simulations currently running

Path Parameters

NameTypeDescription

userid

number

Your user ID

Headers

NameTypeDescription

Authorization

string

Bearer Token

[
    {
        "datasetname": null,
        "datasetdescription": null,
        "imagecount": 0,
        "datasetid": 0,
        "configfile": null,
        "id": <SIMULATION ID>,
        "userid": 3,
        "simulationconfig": "ENCODED BASE64 CONFIG",
        "randomseed": 1.0,
        "isComplete": false,
        "timestamp": "2021-04-29T10:13:59",
        "datasets": [],
        "renderJobs": null
    }
    
    {
    <MORE SIMULATIONS...>
    }
]

Python Request

import requests

url = "https://lexsetapi.lexset.ai/api/simulations/GetActiveSimulations/?userid=<YOUR USER ID>"

payload={}
headers = {
  'Authorization': 'Bearer <YOUR TOKEN>'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

cURL

curl --location --request GET 'https://lexsetapi.lexset.ai/api/simulations/GetActiveSimulations/userid=<YOUR USER ID>' \
--header 'Authorization: Bearer <YOUR TOKEN>'

Last updated