Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Request

HTTP ELEMENT

Value

URI

/rest/crud/1.0/table/$key

METHOD

PUT

Content-Type

application/json

BODY

Code Block
{
	"key": "name-one",			//not required and will be ignore if you put it
	"name": "Name One",			//required
	"description": "description",
	"hidden" : "true", 			//default: false
	"inactiveFlag": "true", 	//default false
	"fields": [{
		"key": "field-one", 	//required, unique within the Table
		"name": "Field One", 	//required
		"type": "ForeignKey",			//enum: Currency, Date, Number, Checkbox, Text, IpAddress, Password, TextArea, Hyperlink, List, Option, Percent, ForeignKey, Integer
								//default: Text
		"required: "false" 		//default: false
		"relation": "name-one",	//required if type = ForeignKey - the Table.key
		"listValues": [			//ignored if type is not List
			"Possible1",
			"Possible2",
			"Possible3"
		]
	}]
}

Possible Response

Scenario

Response

there is no name in the request json body

Code Block
{
    "error": "REQUIRED",
    "message": "jsonBody.name is required"
}

First Field has no key

Code Block
{
    "error": "REQUIRED",
    "message": "jsonBody.fields[0].key is required"
}

First Field has no name

Code Block
{
    "error": "REQUIRED",
    "message": "jsonBody.fields[0].name is required"
}

If first field has the same key as the second field

Code Block
{
    "error": "NOT_UNIQUE",
    "message": "jsonBody.fields[0].name is not unique within it's Table"
}

If First Field has type = Type but there is not relation identified

Code Block
{
    "error": "NOT_UNIQUE",
    "message": "jsonBody.fields[0].name is not unique within it's Table"
}

If First Field is type = Type but table identified by the relation is does not exists.

Code Block
{
    "error": "NON_EXISTING",
    "message": "column.tableEntity[non-existing] doesn't existing."
}

If First Field Type is invalid

Code Block
{
    "error": "VALUE_NOT_VALID",
    "message": "jsonBody.fields[0].type is not valid value - should be Currency, Date, Number, Checkbox, Text, IpAddress, Password, TextArea, Hyperlink, List, Option, Percent, ForeignKey"
}

If table.key already exists

Code Block
{
    "error": "ALREADY_EXIST",
    "message": "Tables[name-one] already exists."
}

POSITIVE

Code Block
{
    "description": "First CRUD Table",
    "hidden": false,
    "inactive": false,
    "fields": [
        {
            "type": "Text",
            "required": true,
            "key": "field-one",
            "id": 1876,
            "name": "Field One"
        },
        {
            "type": "Text",
            "required": false,
            "key": "field-two",
            "id": 1877,
            "name": "Field Two"
        },
        {
            "type": "List",
            "required": true,
            "listValues": [
                "Possible 1",
                "Possible 2",
                "Possible 3"
            ],
            "key": "field-three",
            "id": 1878,
            "name": "Field Three"
        },
        {
            "type": "ForeignKey",
            "relation": {
                "key": "test-config",
                "id": 35,
                "name": "Test Config 2"
            },
            "required": false,
            "key": "field-four",
            "id": 1879,
            "name": "Field Four"
        }
    ],
    "key": "name-one",
    "id": 51,
    "name": "Name One"
}