Add records

This page introduces the API for registering records.

Add records

Method

POST

URI
[your kumaneko domain]/api/records.php
Authentication

Add "X-Authorization" to the request header and specify the Base64 encoded account and password as values. Base64 encoding should be in the form "account: password".

Content-Type

application/json

Parameters
Parameter Value Description
app String

The app ID.

records Array

Array of record object.

A record object is an object that contains record information such as field codes and field values.

References:

Field types

notify Boolean

Specify "true" to send change notifications to each client after processing is completed, and specify "false" not to send change notifications.

If the parameter is not specified, it will be treated as "false".

Response

An object that has the record ID of the last record among the registered records and the numbering result data of each record based on the setting of the automenber field.

{
	id: 8,
	autonumbers: {
		6: 'PD_B00005',
		7: 'PD_B00006',
		8: 'PD_B00007'
	}
}
Sample

JavaScript

fetch('[your kumaneko domain]/api/records.php', {
	method: 'POST',
	headers: {
		'X-Authorization': window.btoa(pd.kumaneko.users.login().account.value+':'+pd.kumaneko.users.login().pwd.value)
	},
	body: JSON.stringify({
		app: '1',
		records: [
			pd.kumaneko.record.get(APP_ID, event.container).record
		]
	})
})
.then(response => {
	response.json().then((json) => {
		switch (response.status)
		{
			case 200:
				console.log(json);
				break;
			default:
				console.error('Error:', json);
				break;
		}
	});
})
.catch(error => {
	console.error('Error:', error);
});

curl

curl -X POST '[your kumaneko domain]/api/records.php' \
	-H 'X-Authorization: L08xCvTh7A1EVm3rZimF98R8VLP3k4lMlzELqyCx' \
	-H 'Content-Type: application/json' \
	-d '{
		"app": "1",
		"records": [
			{
				"field_1_": {
					"value": "Sample"
				},
				"field_2_": {
					"value": 100
				}
			}
		]
	}'

Run Lookup fields

If you enter true in the lookup property of the lookup field, those lookup fields will be retrieved automatically.

To clear the lookup field, empty the value property and enter true for the lookup property.

Sample
"field_10_": {
	"serach": "Sample",
	"value": 1,
	"lookup": true
}