# get()

Canonical URL: https://developers.iagenify.com/zh/sdk/ref/hosts/get/
Language: zh

`api.hosts.get(id) → Promise<Host>`

一个主机,目前部署、域名和证书状态,从平台上重新阅读。

Status: GET · free · re-reads the certificate

```javascript
const host = await api.hosts.get(id);

host.current;      // the deploy currently online
host.certificate;  // "none" | "pending" | "active"
host.domains_;     // the customer domains attached
```

## 使用这种方式才能执行未结证书 {#certificate}

```javascript
let host = await api.hosts.get(id);

while (host.certificate === "pending") {
  await new Promise((r) => setTimeout(r, 10_000));
  host = await api.hosts.get(id);
}
```

无法通知您。 当读取主机时, 状态会重新读取, 也就是在新地址级别上进行部署后, 短时间的民意测验会成为正确的形状 。

## 当前的是在线的 {#current}

答案现在的部署——这不是最新的部署,在经过 [滚回](/zh/sdk/ref/host/rollback). [部署()](/zh/sdk/ref/host/deploys) 历史就是历史。

## 附加域域与它相连 {#domains}

`domains.list()` 也附有同样内容,

## 错误 {#errors}

未知识别信息回答404,包括属于另一个账户的账户,这是目的相同的答案。

- [东道主主](/zh/sdk/ref/host): 宿主携带什么,你能做什么。
- [deploys()](/zh/sdk/ref/host/deploys): 历史

```python
host = api.hosts.get(host_id)

host.current       # the deploy currently online
host.certificate   # "none" | "pending" | "active"
host.domains_      # the customer domains attached
```

```python
import time

host = api.hosts.get(host_id)

while host.certificate == "pending":
    time.sleep(10)
    host = api.hosts.get(host_id)
```
