如何从角度应用中消耗露天API?

发布于 2025-01-17 16:21:22 字数 215 浏览 1 评论 0 原文

我有一个角度应用程序,我想通过API与API与此。我该如何称呼这些API?

另一个问题,我知道可以将ADF与Angular应用程序集成在一起,是否有有关操作方法的教程或指南?

I have an angular application, and I want to interact with Alfresco community 7.1 via APIs from this List . how can I call these APIs?

Another question, I know that is possible to integrate ADF with angular applications, is there any tutorial or guide on how-to ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

仙女山的月亮 2025-01-24 16:21:22

您需要建立使用HTTPModule进行HTTP调用的服务。以下是您服务的示例。

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class AlfrescoService  {
baseUrl="/alfresco/api/-default-/public/alfresco/versions/1";
constructor(private http: HttpClient) {}

getActionDefinitions(): Observable<any> {
  const specificRoute="/action-definitions?skipCount=0&maxItems=100";
  return this.http.get(baseUrl+specificRoute).pipe(
    map(res=>res)
  );
}

在您的角组件中,您需要注入服务并订阅该功能。

constructor(private alfrescoService  : AlfrescoService  ) {}

loadData(){
  this.alfrescoService.getActionDefinitions().subscribe({
    next:res=>{
      console.log(res)
    }
  })
}

you need to build a service that makes HTTP calls using HttpModule. Below is an example your service.

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class AlfrescoService  {
baseUrl="/alfresco/api/-default-/public/alfresco/versions/1";
constructor(private http: HttpClient) {}

getActionDefinitions(): Observable<any> {
  const specificRoute="/action-definitions?skipCount=0&maxItems=100";
  return this.http.get(baseUrl+specificRoute).pipe(
    map(res=>res)
  );
}

in your angular component you need to inject your service and subscrib to the function.

constructor(private alfrescoService  : AlfrescoService  ) {}

loadData(){
  this.alfrescoService.getActionDefinitions().subscribe({
    next:res=>{
      console.log(res)
    }
  })
}
久隐师 2025-01-24 16:21:22

如果您想与Angular应用程序与Alfresco API进行互动:

我建议您从alfresco Webservices的OpenAPI定义中生成一个角客户端:

npm install @openapitools/openapi-generator-cli -g
openapi-generator-cli generate -g typescript-angular -i https://api-explorer.alfresco.com/api-explorer/definitions/alfresco-auth.yaml -o /<PATH_TO_OUTPUT>/

alfresco yaml在这里:

​API,然后使用所需的API。

如果您想链接到某些ADF文档,尤其是Howtos

我建议您查看正式文档:

If you want to interact with Alfresco API with an Angular Application :

I would suggest you generate an angular client from the OpenAPI Defintion of Alfresco webservices :

npm install @openapitools/openapi-generator-cli -g
openapi-generator-cli generate -g typescript-angular -i https://api-explorer.alfresco.com/api-explorer/definitions/alfresco-auth.yaml -o /<PATH_TO_OUTPUT>/

The Alfresco yaml are here :

Then, use the generated services to get a ticket from the authentication API, and then use the APIs you need.

If you want a link to some ADF documentation and in particular howtos

I would suggest you to look at the official documentation :
https://www.alfresco.com/abn/adf/docs/tutorials/creating-your-first-adf-application/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文