Developer Function: Script: $p.apiGetClosestSiteId
## Overview
This is a script function that retrieves the site ID closest to the relevant site by "「Site Name Search」" using an Ajax POST request.
## Prerequisites
1. This function searches for the "Site name" of the site. Please set the site name in advance. Please note that this is not the "「Title」" of the site.

## Syntax
##### JavaScript
```
$p.apiGetClosestSiteId({
id: <site ID to start search>,
data: {
<acquisition conditions>
},
done: <any process>,
fail: <any process>,
always: <any process>
});
```
## Description of Each Parameter
|Parameter name|Description|Required|
|:--|:--|:--:|
|id|Site ID to start search. Usually, you use $p.siteId() to specify the ID of the site that is calling this method. |Yes|
|data|Acquisition conditions|Yes|
|done|API communication successful|Yes|
|fail|API communication failure|-|
|always|Completion|-|
## Acquisition Conditions
|Keyword|Description|Required|
|:--|:--|:--:|
|FindSiteNames|Specify the site names you want to search for as an array. |Yes|
## Usage Example
### Call
##### JavaScript
```
$p.apiGetClosestSiteId({
id: $p.siteId(),
data: {
FindSiteNames:['ParentSite','HideSize']
},
done: function (data) {
console.log(data);
}
});
```
### Response
##### JavaScript
```
{
"SiteId": 12345,
"Data": [
{
"SiteName": "ParentSite",
"SiteId": 12344
},
{
"SiteName": "HideSite",
"SiteId": -1
}
]
}
```
## Related Information
<div id="ManualList">
<article class="s-blog_list_unit"><h2>
<h2>The specified information was not found.</h2>
<p><a href="/ja/manual">Return to top</a></p>
</article>
</div><input id="SearchTextHidden" type="hidden" value="" />