#
4. Get Sub District List by District ID
Get Sub Districts — Retrieve the reference list of sub-districts filtered by the selected district; returns a standard response envelope for populating area selectors.
#
Overview
- Auth
- --
- Method
GET
#
Path
https://partners-api.tocobagus.net/api/v1
/partner/reference/areas/sub-districts
#
Request
#
Query Parameters
Required headers: None.
#
Request Payload
Request payload: Not used for
GET.
#
Example Request
curl -X GET "http:///partner/reference/areas/sub-districts?districtId=%3CdistrictId%3E" \
-H "Content-Type: application/json" \
const qs = new URLSearchParams({
"districtId": "<districtId>"
});
const url = "http:///partner/reference/areas/sub-districts" + (qs.toString() ? "?" + qs.toString() : "");
const res = await fetch(url, {
method: "GET",
headers: {}
});
const json = await res.json();
console.log(json);
qs := url.Values{}
qs.Set("districtId", "<districtId>")
u := "http:///partner/reference/areas/sub-districts"
if q := qs.Encode(); q != "" { u = u + "?" + q }
req, _ := http.NewRequest("GET", u, nil)
req.Header.Set("Content-Type","application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
b, _ := io.ReadAll(resp.Body)
fmt.Println(string(b))
var client = java.net.http.HttpClient.newHttpClient();
var req = java.net.http.HttpRequest.newBuilder()
.uri(java.net.URI.create("http:///partner/reference/areas/sub-districts?districtId=%3CdistrictId%3E"))
.header("Content-Type","application/json")
.method("GET", java.net.http.HttpRequest.BodyPublishers.noBody())
.build();
var res = client.send(req, java.net.http.HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
#
Responses
#
Example Responses
{
"success": true,
"message": "Sub Districts retrieved successfully",
"data": [
{
"id": "b7c6429d-e200-4abc-a92f-d3dbf96cf64d",
"name": "A U R",
"postalCode": 20151
},
{
"id": "992f7cd7-40af-4861-b2f3-91f53e4dbfb5",
"name": "J A T I",
"postalCode": 20152
},
{
"id": "8d3afcc7-8e65-430b-a0f4-01fca0d766c7",
"name": "Kampung Baru",
"postalCode": 20158
},
{
"id": "596324da-31cf-4b3b-ae84-7ffad7a88e59",
"name": "Hamdan",
"postalCode": 20151
},
{
"id": "ab7208ea-3363-443d-9d7f-fbdd7da86239",
"name": "Sei Mati",
"postalCode": 20159
},
{
"id": "d7204fea-c767-4df7-bccb-88c989c04647",
"name": "Sukaraja",
"postalCode": 20159
}
]
}
#
Dictionary
None for this endpoint.
#
Notes
None for this endpoint.