Developer Function: API: Table Operation: Create Record
Overview¶
You can create new records using the API.
Preparation¶
Please Create an API Key before performing API operations.
Request¶
Send json data in the following request format:
| Setting column | Value |
|---|---|
| HTTP Method | POST |
| Content-Type | application/json |
| Character Code | UTF-8 |
| URL | http://{server name}/api/items/{site ID}/create (*1) |
| Body | Please refer to the json data below |
(*1) Please edit the {server name} and {site ID} parts to suit your environment as appropriate.
For preceder.net, the format is as follows:
https://pleasanter.net/fs/api/items/{site ID}/create
Insert Image by API¶
You can insert an image into the "Body", "Comment" and "Description" column by specifying an ImageHash in the Body.
When updating a record using this function with an update API (update/upsert), the corresponding column of the existing record will be overwritten in the "Body" and "Description" columns, and added in the "Comment" column. In addition, if you specify only ImageHash without specifying Body or DescriptionHash, which specify the string to be registered in the description field in an update API, it will be added rather than overwritten.
How to Specify ImageHash¶
| 1st Level | 2nd Level | 3rd Level | Description | Example |
|---|---|---|---|---|
| ImageHash | Body | HeadNewLine | Specify whether to insert a newline at the beginning of the image with true/false. If omitted, there will be no newline. | true |
| EndNewLine | Specifies whether to insert a newline at the end of the image with true/false. If omitted, there will be no newline. | true | ||
| Position | Specifies the position of the image to insert when setting a string in the target item in the same request. If -1 is specified or omitted, it will be inserted at the end. | 3 | ||
| Alt | Specifies the string to insert into the alt attribute (text displayed instead of the image when the image cannot be displayed in the web browser). If omitted, "image" will be set. | hayato | ||
| Extension | Specifies the file extension to register in the Binaries table. If omitted, ".png" will be set. | .jpeg | ||
| Base64 | Specify the Base64 encoded binary data of the image as a string. If you specify ImageHash, this cannot be omitted. | iVBORw0KG…(the following omitted) | ||
| Comments | (same as above) | (same as above) | - | |
| DescriptionA | (same as above) | (same as above) | - | |
| DescriptionB | (same as above) | (same as above) | - |
Executing Processes via API¶
You can execute a process by specifying the Process ID in the request data.
Preconfiguration¶
PLease set up the "Process" in advance.
Limitations¶
When executing a process via the API, input validation set for the process
Process Specifying Method¶
Either ProccessId or ProccessIds should be set. If both are set, ProccessIds is applied.
Note that when ProccessIds is set, the specified multiple process IDs will be executed in the order in which they appear in the list of "Process" set in advance.
| Setting Item | Description | Example |
|---|---|---|
| ProccessId | Specify the ID of the process. | 1 |
| ProccessIds | Specify IDs for multiple processes. | [1,2,3] |
JSON¶
{
"ApiVersion": 1.1,
"ApiKey": "XXXXXXXXXX...",
"Title": "Develop new function XX",
"Body": "body",
"CompletionTime": "2018/3/31",
"ProcessId": 1,
"ClassHash": {
"ClassA": "Classification",
"ClassB": "Unclassified",
"ClassC": "Others"
},
"NumHash": {
"NumA": 100,
"NumB": 200
},
"DateHash": {
"DateA": "2019/01/01",
"DateB": "2020/01/01"
},
"DescriptionHash": {
"DescriptionA": "Description",
"DescriptionB": "Overview",
"DescriptionC": "Supplement"
},
"CheckHash": {
"CheckA": true,
"CheckB": false
},
"AttachmentsHash": {
"AttachmentsA": [
{
"ContentType": "text/plain",
"Name": "Readme.txt",
"Base64": "5yY5Trfi4..."
}
]
},
"ImageHash": {
"Body": {
"HeadNewLine": true,
"EndNewLine": true,
"Position": 3,
"Alt": "imageBody",
"Extension": ".jpeg",
"Base64": "iVBORw0KG..."
},
"DescriptionA": {
"HeadNewLine": true,
"EndNewLine": true,
"Position": 3,
"Alt": "imageDescriptionA",
"Extension": ".jpeg",
"Base64": "iVBORw0KG..."
}
}
}
Response¶
The json data in the following format will be returned.
JSON¶
{
"Id": 12345,
"StatusCode": 200,
"LimitPerDate": 10000,
"LimitRemaining": 9996,
"Message": "\"Develop new feature XX\" created."
}
Confirmation Column in Case of Error¶
・Precautions when using the API and things to check if an error occurs
・FAQ: What to check if modified configuration files or API requests (JSON format) are not recognized correctly
Specification Changes¶
*API specifications have been partially changed since October 2019.**
- Classification, Numerical Value, Date, Description, and Check Column have been changed from being directly entered in the JSON to being entered within "~Hash".
*API specifications have been partially changed since November 2018.**
- The URL format has been changed from '/pleasanter/api_items/xxxx' to '/pleasanter/api/items/xxxx'.
- The Content-Type specification has been changed from 'application/x-www-form-urlencoded' to 'application/json'.