Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 2 Next »

Request

HTTP ELEMENT

Value

URI

/rest/crud/1.0/$tableKey

METHOD

POST

Content-Type

application/json

BODY

name - name of the Data - REQUIRED

key - key of the data - REQUIED - should be unique within the table
column.keys - This is the field define on CREATE TABLE - NO if there is no column defined

SAMPLE

{
    "name": "name3", 
	"spaceKey": "DEMO", 
	"key": "name3",
	//json element name is base from column.key on database 
    "field-currency": 200, //currency must be a number 
    "field-number": "1", //number must be a number 
    "field-percent": "2", //percent must be a number
    "field-required": "required", //if field is required, should be required
    "field-checkbox": "false", // must be true/false 
    "field-ipaddress": "121212121", //must be a ipv4 ip-address
    "field-hyperlink": "https://google.com.ph?q=yes", // must be a http or https url 
    "field-type": {
    	"id": "56", 
        "key": "key1", // for field of type Type, id or key is mandatory/required. If both is present, key will be ignore. 
    	"name": "wtf"
    }
}

Response

HTTP STATUS CODE

BODY

200

id - internal id of the data - System Generated

name - name of the Data, the same as what you pout on the request

key - key of the Data, the same as what you put on the request

spaceKey - space where Data

400

error - main category of the error

message - error message

404

Scenario

Response

POSITIVE/Good Request

{
    "field-percent": "2",
    "field-required": "required",
    "field-currency": "200",
    "field-checkbox": "false",
    "name": "name3",
    "key": "name3",
    "field-number": "1",
    "field-ipaddress": "121212121",
    "id": 61,
    "field-type": {
        "id": 56,
        "name": "name3"
    },
    "field-hyperlink": "https://google.com.ph?q=yes"
}

$key is not specify

{
	"spaceKey": "DEMO",
	"name": "name3",
    "field-type": {
        "id": 56,
        "name": "name3"
    },
    "field-hyperlink": "https://google.com.ph?q=yes"
}

HTTP STATUS: 400

{
    "error": "REQUIRED",
    "message": "key is required"
}

$key is not unique within the table

{
    "error": "VALUE_NOT_VALID",
    "message": "key[sixth-entity] on table[name-one] already exist - key should be unique within a table"
}

$name is not specify

{
	"spaceKey": "DEMO",
    "field-type": {
        "id": 56,
        "name": "name3"
    },
    "field-hyperlink": "https://google.com.ph?q=yes"
}

HTTP STATUS: 400

{
    "error": "REQUIRED",
    "message": "name is required"
}

$spaceKey is not specified

{
	"name": "Row 1st",
    "field-type": {
        "id": 56,
        "name": "name3"
    },
    "field-hyperlink": "https://google.com.ph?q=yes"
}

HTTP STATUS: 400

{
    "error": "REQUIRED",
    "message": "spaceKey is required"
}

$spaceKey is non-existing

HTTP STATUS: 400

{
    "error": "NON_EXISTING",
    "message": "Space[DEM] does not exists"
}

$tableKey is non-existing

HTTP STATUS: 404

{
    "error": "NOT FOUND",
    "message": "URL doesn't point to existing table"
}

$row[0].id is non-existing

{
    "name": "second Entity",
    "key": "sixthz-entity",
    "field-fk": [{
    	"id": "14700"
    }],
    "spaceKey": "CIA2"
}

{
    "error": "VALUE_NOT_VALID",
    "message": "value.id[14700] of field[field-fk] refer to non-existing Row"
}

$row[0].key is non-existing

{
    "name": "second Entity",
    "key": "sixthz-entity",
    "field-fk": [{
    	"key": "keyvalue1"
    }],
    "spaceKey": "CIA2"
}

{
    "error": "VALUE_NOT_VALID",
    "message": "value.id[keyvalue1] of field[field-fk] refer to non-existing Row"
}

$row identified by id or key existing but it’s Table is not the same as defined in the Column

{
    "name": "second Entity",
    "key": "sixthz-entity",
    "field-fk": [{
    	"id": "19104",
    	"key": "open"
    }],
    "spaceKey": "CIA2"
}

{
    "error": "VALUE_NOT_VALID",
    "message": "value.id[19104] entity type doesn't match with what is defined."
}

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.