Create

Used for adding new entities.

The creation of entities must be done methodically to ensure the relationships are formed correctly. To ensure this occurs, create parent entities in a separate request before attempting to create the child entities.

Details

  • URL: /api/createRec

  • Method: POST

  • Request Data Params: A grid with one or more rows for each entity to be added with the following columns:

    Column Required Kind Value description
    dis Str A human friendly display name for the entity
    A primary marker tag for the entity e.g. site, equip, space or point marker Marker tag indication m:
    id ref A user supplied id in place of the WideSky generated UUID
    Any other tag e.g. name, elec, his (any) Corresponding tag value
  • Response: A grid with a row for each newly created entity with an additional WideSky generated UUID in the id column. The rows in the returned grid will follow the same ordering as those given in the request grid. If an input row specified an id, then that value will be used to identify the entity, and will be returned in the id column. Otherwise, a new unique UUID will be generated by WideSky.

Examples

Specifying name

  • Request:

    POST /api/createRec HTTP/1.1
    Host: example.on.widesky.cloud
    Authorization: Bearer <authToken>
    Accept: application/json
    Content-Type: application/json
    
    {
      "meta": {
        "ver": "2.0"
      },
      "cols": [
        {
          "name": "dis"
        },
        {
          "name": "site"
        },
        {
          "name": "tz"
        }
      ],
      "rows": [
        {
          "dis": "s:My Site",
          "site": "m:",
          "tz": "s:Brisbane"
        }
      ]
    }
    
  • Response:

    {
      "meta": {
        "ver": "2.0"
      },
      "cols": [
        {
          "name": "id"
        },
        {
          "name": "dis"
        },
        {
          "name": "site"
        },
        {
          "name": "tz"
        }
      ],
      "rows": [
        {
          "id": "r:7c7a91bd-d3af-4977-b2c0-65f0dddb6f7b",
          "dis": "s:My Site",
          "site": "m:",
          "tz": "s:Brisbane"
        }
      ]
    }
    

Specifying id

  • Request:
    POST /api/createRec HTTP/1.1
    Host: example.on.widesky.cloud
    Authorization: Bearer <authToken>
    Accept: application/json
    Content-Type: application/json
    
    {
      "meta": {
        "ver": "2.0"
      },
      "cols": [
        {
          "name": "id"
        },
        {
          "name": "dis"
        },
        {
          "name": "site"
        },
        {
          "name": "tz"
        }
      ],
      "rows": [
        {
          "id": "r:9bd4756a-ff30-4142-ab90-dadb0b8b4b58",
          "dis": "s:My nameless site",
          "site": "m:",
          "tz": "s:Brisbane"
        }
      ]
    }
    
  • Response:
    {
      "meta": {
        "ver": "2.0"
      },
      "cols": [
        {
          "name": "id"
        },
        {
          "name": "dis"
        },
        {
          "name": "site"
        },
        {
          "name": "tz"
        }
      ],
      "rows": [
        {
          "id": "r:9bd4756a-ff30-4142-ab90-dadb0b8b4b58",
          "dis": "s:My Site",
          "site": "m:",
          "tz": "s:Brisbane"
        }
      ]
    }
    

Specifying name and id

  • Request:
    POST /api/createRec HTTP/1.1
    Host: example.on.widesky.cloud
    Authorization: Bearer <authToken>
    Accept: application/json
    Content-Type: application/json
    
    {
      "meta": {
        "ver": "2.0"
      },
      "cols": [
        {
          "name": "id"
        },
        {
          "name": "name"
        },
        {
          "name": "dis"
        },
        {
          "name": "site"
        },
        {
          "name": "tz"
        }
      ],
      "rows": [
        {
          "id": "r:37790aef-44a7-47ce-8dad-623ecde369b7",
          "name": "s:mySiteWithId",
          "dis": "s:My Site, with ID given",
          "site": "m:",
          "tz": "s:Brisbane"
        }
      ]
    }
    
  • Response:
    {
    "meta": {
      "ver": "2.0"
    },
    "cols": [
      {
        "name": "id"
      },
      {
        "name": "name"
      },
      {
        "name": "dis"
      },
      {
        "name": "site"
      },
      {
        "name": "tz"
      }
    ],
    "rows": [
      {
        "id": "r:37790aef-44a7-47ce-8dad-623ecde369b7 mySiteWithId",
        "name": "s:mySiteWithId",
        "dis": "s:My Site, with ID given",
        "site": "m:",
        "tz": "s:Brisbane"
      }
    ]
    }