【发布时间】:2018-05-24 02:34:07
【问题描述】:
我的 API 有一个 get 方法,它公开 4 个对象,每个对象包含 1 个 href,我需要在执行第一个 GET 后使用 href 发出 4 个 get 请求
API 合约
{
"tipoDocumentoCliente": "CPF",
"documentoCliente": "9687023767",
"nomeCliente": "RAFAEL HERMOGENES DE MENDONCA",
"dataNascimentoCliente": "1982-04-14T00:00:00",
"sexoCliente": "MASCULINO",
"estadoCivilCliente": "CASADO",
"cpfCliente": "9687023767",
"cnpjCliente": null,
"celCliente": null,
"profissaoCliente": "Analista de desenvolvimento de sistemas",
"rendaCliente": 12000,
"escolaridadeCliente": null,
"matricula": 0,
"contas": {
"method": "Get",
"rel": "get-contas",
"href": "http://localhost:62474/api/v1/Contas/9687023767"
},
"enderecos": {
"method": "Get",
"rel": "get-enderecos",
"href": "http://localhost:62474/api/v1/Endereco/9687023767"
},
"telefones": {
"method": "Get",
"rel": "get-telefones",
"href": "http://localhost:62474/api/v1/Phones/9687023767"
},
"emails": {
"method": "Get",
"rel": "get-emails",
"href": "http://localhost:62474/api/v1/Emails/9687023767"
}
}
这就是我如何向我的 api 发出单个请求
public ObterFundos<T>(cpf: number): Observable<T> {
return this.http.get<T>(this._calcularFundosUrl + cpf);
}
我不知道我将如何使用请求中的 href
【问题讨论】: