2.0 REST API

From AlfrescoWiki

(Redirected from HTTP API 2.0)
Jump to: navigation, search

Contents

[edit] Introduction

This page describes HTTP API functionality introduced in Alfresco v2.0 and is specific to v2.0 only. Alfresco v2.1 expands upon the HTTP API considerably.

Alfresco v2.0 has HTTP support for:

[edit] HTTP APIs

[edit] API Index

The "list all APIs" URL is:

GET http://<host>:<port>/alfresco/service/index

Response Formats:

  1. html (default)

[edit] Search

See OpenSearch.

[edit] HTTP Response Formats

All URLs support the format argument for specifying the response type.

Formats available are:

  • html => text/html
  • atom => application/atom+xml
  • rss => application/rss+xml
  • xml => text/xml
  • json => application/json
  • opensearchdescription => application/opensearchdescription+xml

e.g.

GET http://<host>:<port>/service/<service>?format=atom

[edit] Authentication

Alfresco is a secure server and requires authenticated access.

For now, the APIs (where applicable) support:

  1. Alfresco Web Client Authentication
  2. HTTP Basic Authentication

Other forms of authentication will also be considered:

  1. ATOM authentication mechanism (such as http://www.xml.com/pub/a/2003/12/17/dive.html)

[edit] Guest Access

Some Services allow guest access. To force guest access specify the following url argument:

guest=true

e.g.

http://<host>:<port>/alfresco/service/search/keyword?q=tutorial&guest=true

[edit] Selecting an Authentication Mechanism

/alfresco/config/web-api-application-context.xml
<!-- Alfresco Web Client Authentication (Default) -->
<alias alias="web.api.Authenticator" name="web.api.AlfWebClientAuthenticator" />

or

<!-- Basic HTTP Authentication -->
<alias alias="web.api.Authenticator" name="web.api.BasicAuthenticator" />

[edit] Logging

Alfresco server debug information may be logged by adding the following log4j entry:

log4j.logger.org.alfresco.web.api=debug