Import
Overview¶
Import department information using API.
Preparations¶
Please Create an API Key before performing API operations.
Request¶
Send CSV data and JSON parameters in the following request format:
| Setting column | Value |
|---|---|
| HTTP Method | POST |
| Content-Type | multipart/form-data |
| Character Code | UTF-8 |
| URL | http://{server name}/api/depts/import1 |
| Body | See "Column to specify in Body" below |
Column to specify in the body¶
| Column name | Value |
|---|---|
| parameters | Specify the contents of the "API Parameters" below as a JSON format string |
| file | Binary data of the CSV file to be registered |
API Parameters¶
| Column name | e.g. | Notes |
|---|---|---|
| ApiVersion | 1.1 | API version |
| ApiKey | 3da0fa3a7R61faf821... | Acquired API key |
| Encoding | Shift-JIS | CSV file encoding. Specify "UTF-8" or "Shift-JIS" |
Execution Example Sample¶
PowerShell (version 6.0 or later) Sample¶
PowerShell
$uri = 'http://servername/api/depts/import'
$filePath = "./sample.csv"
$form = @{
parameters = ConvertTo-Json @{
ApiVersion = 1.1;
ApiKey = "4d84b4773a58bbc3c4...";
Encoding = "UTF-8";
};
file = Get-Item -Path $filePath;
}
Invoke-WebRequest -Uri $uri -Method Post -Form $form
Python Sample¶
Python
import requests
import json
url = "https://servername/api/depts/import"
filePath = "./sample.csv"
data = {
"parameters": json.dumps({
"ApiVersion" : 1.1,
"ApiKey" : "4d84b4773a58bbc3c4...",
"Encoding" : "UTF-8"
})
}
files = {
"file":("sample.csv", open(filePath,"rb"), "text/csv")
}
response = requests.post(url, data, files=files)
print(response.content.decode())
Response¶
JSON data in the following format is returned.
Supported Versions¶
| Supported Versions | Body |
|---|---|
| 1.3.48.0 and later | Added function |
Confirmation Column in Case of Error¶
- An error occurs when executing the API
- What to check if modified configuration files or API requests (JSON format) are not recognized correctly
-
Please edit the {server name} part to suit your environment as appropriate. ↩