curl --request PUT \
--url https://apiweb.mile.app/api/v4/data/{_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dataId": "OutletAdi",
"dataTypeId": "63f854cff2bd7b342a098962",
"hubId": "63c63ab1b6972d3150348172",
"outletName": "Cabang Jakarta Pusat",
"outletHours": 12,
"outletType": "minimarket",
"outletOpen": "09:00",
"outletClose": "17:00",
"outletContractExpired": "2023-02-02",
"outletOpenInWeekend": true,
"outletGeolocation": "-6.171702325136309,106.81775093078615",
"outletPhoneNumber": "+62 123 456 789",
"outletCloseOrder": "2023-02-02 17:00:00"
}
'import requests
url = "https://apiweb.mile.app/api/v4/data/{_id}"
payload = {
"dataId": "OutletAdi",
"dataTypeId": "63f854cff2bd7b342a098962",
"hubId": "63c63ab1b6972d3150348172",
"outletName": "Cabang Jakarta Pusat",
"outletHours": 12,
"outletType": "minimarket",
"outletOpen": "09:00",
"outletClose": "17:00",
"outletContractExpired": "2023-02-02",
"outletOpenInWeekend": True,
"outletGeolocation": "-6.171702325136309,106.81775093078615",
"outletPhoneNumber": "+62 123 456 789",
"outletCloseOrder": "2023-02-02 17:00:00"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
dataId: 'OutletAdi',
dataTypeId: '63f854cff2bd7b342a098962',
hubId: '63c63ab1b6972d3150348172',
outletName: 'Cabang Jakarta Pusat',
outletHours: 12,
outletType: 'minimarket',
outletOpen: '09:00',
outletClose: '17:00',
outletContractExpired: '2023-02-02',
outletOpenInWeekend: true,
outletGeolocation: '-6.171702325136309,106.81775093078615',
outletPhoneNumber: '+62 123 456 789',
outletCloseOrder: '2023-02-02 17:00:00'
})
};
fetch('https://apiweb.mile.app/api/v4/data/{_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiweb.mile.app/api/v4/data/{_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'dataId' => 'OutletAdi',
'dataTypeId' => '63f854cff2bd7b342a098962',
'hubId' => '63c63ab1b6972d3150348172',
'outletName' => 'Cabang Jakarta Pusat',
'outletHours' => 12,
'outletType' => 'minimarket',
'outletOpen' => '09:00',
'outletClose' => '17:00',
'outletContractExpired' => '2023-02-02',
'outletOpenInWeekend' => true,
'outletGeolocation' => '-6.171702325136309,106.81775093078615',
'outletPhoneNumber' => '+62 123 456 789',
'outletCloseOrder' => '2023-02-02 17:00:00'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiweb.mile.app/api/v4/data/{_id}"
payload := strings.NewReader("{\n \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://apiweb.mile.app/api/v4/data/{_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/data/{_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data": {
"_id": "63dc641b1ed1fd63ad0c9013",
"dataId": "Outlet",
"dataTypeId": "63db2fb476bc679c540369c4",
"outletName": "Cabang Jakarta Pusat",
"outletHours": 12,
"outletType": "minimarket",
"outletOpen": "09:00",
"outletClosed": "17:00",
"outletContractExpired": "2023-02-02",
"outletOpenInWeekend": true,
"outletGeolocation": "-6.171702325136309,106.81775093078615",
"outletPhoneNumber": "+62 123 456 789",
"outletCloseOrder": "2023-02-02 17:00:00",
"hubId": "63c63ab1b6972d3150348172",
"organizationId": "63c61d865347e356d05e3052",
"createdBy": "john.doe@example.com",
"updatedTime": "2023-02-03 01:32:11",
"createdTime": "2023-02-03 01:32:11"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Update data
Replaces a record’s values. Send dataTypeId and every field value. A record of another hub than the caller’s is refused with failedCode data-035; an unknown _id returns 404 with failedCode data-033.
One hub per record. A record belongs to one hub, hubId (a string). A hub list in the body collapses to its first hub. A data type with commonData true has no hub, and sending hubId for it is refused with failedCode data-032.
The Title. dataId is the record’s Title and key, unique within its data type and hub. On a v4-only type it may contain spaces between words; on a v3-compatible type only letters, digits, - and _.
Field rules. On a v4-only data type the v4 field rules apply: validations, unique and uniqueTogether (per hub), multiOption, boolean and relation values (a belongsTo field takes the target record _id, a belongsToMany field a list of ids). On a v3-compatible type, the v3 rules apply. Keys that are not fields of the data type are refused. While the record’s data type is being prepared or registering unique values, writes answer 409 with failedCode dtype-036.
Requires permission edit/data.
curl --request PUT \
--url https://apiweb.mile.app/api/v4/data/{_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dataId": "OutletAdi",
"dataTypeId": "63f854cff2bd7b342a098962",
"hubId": "63c63ab1b6972d3150348172",
"outletName": "Cabang Jakarta Pusat",
"outletHours": 12,
"outletType": "minimarket",
"outletOpen": "09:00",
"outletClose": "17:00",
"outletContractExpired": "2023-02-02",
"outletOpenInWeekend": true,
"outletGeolocation": "-6.171702325136309,106.81775093078615",
"outletPhoneNumber": "+62 123 456 789",
"outletCloseOrder": "2023-02-02 17:00:00"
}
'import requests
url = "https://apiweb.mile.app/api/v4/data/{_id}"
payload = {
"dataId": "OutletAdi",
"dataTypeId": "63f854cff2bd7b342a098962",
"hubId": "63c63ab1b6972d3150348172",
"outletName": "Cabang Jakarta Pusat",
"outletHours": 12,
"outletType": "minimarket",
"outletOpen": "09:00",
"outletClose": "17:00",
"outletContractExpired": "2023-02-02",
"outletOpenInWeekend": True,
"outletGeolocation": "-6.171702325136309,106.81775093078615",
"outletPhoneNumber": "+62 123 456 789",
"outletCloseOrder": "2023-02-02 17:00:00"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
dataId: 'OutletAdi',
dataTypeId: '63f854cff2bd7b342a098962',
hubId: '63c63ab1b6972d3150348172',
outletName: 'Cabang Jakarta Pusat',
outletHours: 12,
outletType: 'minimarket',
outletOpen: '09:00',
outletClose: '17:00',
outletContractExpired: '2023-02-02',
outletOpenInWeekend: true,
outletGeolocation: '-6.171702325136309,106.81775093078615',
outletPhoneNumber: '+62 123 456 789',
outletCloseOrder: '2023-02-02 17:00:00'
})
};
fetch('https://apiweb.mile.app/api/v4/data/{_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiweb.mile.app/api/v4/data/{_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'dataId' => 'OutletAdi',
'dataTypeId' => '63f854cff2bd7b342a098962',
'hubId' => '63c63ab1b6972d3150348172',
'outletName' => 'Cabang Jakarta Pusat',
'outletHours' => 12,
'outletType' => 'minimarket',
'outletOpen' => '09:00',
'outletClose' => '17:00',
'outletContractExpired' => '2023-02-02',
'outletOpenInWeekend' => true,
'outletGeolocation' => '-6.171702325136309,106.81775093078615',
'outletPhoneNumber' => '+62 123 456 789',
'outletCloseOrder' => '2023-02-02 17:00:00'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiweb.mile.app/api/v4/data/{_id}"
payload := strings.NewReader("{\n \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://apiweb.mile.app/api/v4/data/{_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/data/{_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dataId\": \"OutletAdi\",\n \"dataTypeId\": \"63f854cff2bd7b342a098962\",\n \"hubId\": \"63c63ab1b6972d3150348172\",\n \"outletName\": \"Cabang Jakarta Pusat\",\n \"outletHours\": 12,\n \"outletType\": \"minimarket\",\n \"outletOpen\": \"09:00\",\n \"outletClose\": \"17:00\",\n \"outletContractExpired\": \"2023-02-02\",\n \"outletOpenInWeekend\": true,\n \"outletGeolocation\": \"-6.171702325136309,106.81775093078615\",\n \"outletPhoneNumber\": \"+62 123 456 789\",\n \"outletCloseOrder\": \"2023-02-02 17:00:00\"\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Success",
"data": {
"_id": "63dc641b1ed1fd63ad0c9013",
"dataId": "Outlet",
"dataTypeId": "63db2fb476bc679c540369c4",
"outletName": "Cabang Jakarta Pusat",
"outletHours": 12,
"outletType": "minimarket",
"outletOpen": "09:00",
"outletClosed": "17:00",
"outletContractExpired": "2023-02-02",
"outletOpenInWeekend": true,
"outletGeolocation": "-6.171702325136309,106.81775093078615",
"outletPhoneNumber": "+62 123 456 789",
"outletCloseOrder": "2023-02-02 17:00:00",
"hubId": "63c63ab1b6972d3150348172",
"organizationId": "63c61d865347e356d05e3052",
"createdBy": "john.doe@example.com",
"updatedTime": "2023-02-03 01:32:11",
"createdTime": "2023-02-03 01:32:11"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Path Parameters
Body
The identifier of data type.
Use GET /data-types API to get the list of Data Type IDs.
Example: 63db2fb476bc679c540369c4
The identifier for the hub that generated by system. hubId is not required if the commonData configuration for the data type is true.
Use GET /hubs API to get the list of Hub IDs.
Example: 63c63ffbdef63e6f641aac72
The dynamic field, outlet name. Use GET /data-types API to get detail fields of data source.
Example: Cabang Jakarta Pusat
The dynamic field, outlet hours. Use GET /data-types API to get detail fields of data source.
Example: 12
The dynamic field, outlet type. Use GET /data-types API to get detail fields of data source.
Example: minimarket
The dynamic field, outlet open. Use GET /data-types API to get detail fields of data source.
Example: 09:00
The dynamic field, outlet closed. Use GET /data-types API to get detail fields of data source.
Example: 17:00
The dynamic field, outlet contract expired. Use GET /data-types API to get detail fields of data source.
Example: 2023-02-02
The dynamic field, outlet open in weekend. Use GET /data-types API to get detail fields of data source.
Example: true
The dynamic field, outlet geolocation. Use GET /data-types API to get detail fields of data source.
Example: -6.171702325136309,106.81775093078615