Developer Function: Script: $p.apiUpsert
## Overview
This section explains the methods that allow you to create and update records and Wikis using Ajax POST requests.
## How To Use
##### JavaScript
```
$p.apiUpsert({
id: <Site ID>,
data: {
<data>
},
done: <Optional Processing>,
fail: <Optional Processing>,
always: <Optional Processing>
});
```
## Description Of Each Parameter
|Parameter name|Description|
|:--|:--|
|Site ID|Optional site ID|
|Data|json data to POST|
|Optional processing|Processing when API communication is successful (done: required), when it fails (fail: optional), and when it is completed (always: optional)|
## How To Write
##### JavaScript
```
$p.apiUpsert({
id: 123,
data: {
ApiVersion: 1.1,
Keys: [
'ClassA',
'ClassB'
],
ClassHash: {
ClassA: 'test data',
ClassB: 'Test data details'
}
},
done: function (data) {
console.log(data);
},
fail: function (data) {
console.log(data);
},
always: function (data) {
console.log(data);
}
});
```