UPDATE/REPLACE Data
Request
HTTP ELEMENT | Value |
---|---|
URI | /rest/crud/1.0/$tableKey/$id or /rest/crud/1.0/$tableKey/$key |
METHOD | PUT |
Content-Type | application/json |
BODY | name - name of the Data - REQUIRED spaceKey - space where Data will be attached - REQUIRED column.keys - This is the field defined on CREATE Table SAMPLE {
"name": "name3",
"spaceKey": "DEMO",
//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", // for field of type Type, id is mandatory/required
"name": "wtf"
}
} |
Response
STATUS | BODY |
---|---|
200 | id - id of the Data which is System Generated and cannot be change key - key of the Data which is User Defined and cannot be change name - name of the Data the same as what you put on the request spaceKey - space where Data will be attached same as what you put on the request column.keys - This is the field defined on CREATE TABLE same as what you put on the request
|
400 | error - main category of the error message - error message |
404 |
Scenario and Possible Response
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
|
$key is not unique within the table | |
$name is not specify | HTTP STATUS: 400 |
$spaceKey is not specified | HTTP STATUS: 400 |
$spaceKey is non-existing | HTTP STATUS: 400 |
$tableKey is non-existing | HTTP STATUS: 404 |
$row[0].id is non-existing |
|
$row[0].key is non-existing |
|
$row identified by id or key existing but it’s Table is not the same as defined in the Column |
|
column is required |
|