Document (Collection)


Get a list of documents of an API

GET https://apis.wso2.com/api/am/publisher/v0.13/apis/{apiId}/documents

This operation can be used to retrive a list of documents belonging to an API by providing the id of the API.

OAuth 2.0 Scope

apim:api_viewi

Request

GET https://localhost:9443/api/am/publisher/v0.13/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8

Response

HTTP/1.1 200 OK Content-Type: application/json { "previous": "", "list": [ { "visibility": "API_LEVEL", "sourceType": "INLINE", "sourceUrl": null, "otherTypeName": null, "documentId": "0bcb7f05-599d-4e1a-adce-5cb89bfe58d5", "summary": "This is a sample documentation for v1.0.0", "name": "PhoneVerification API Documentation", "type": "HOWTO" }, { "visibility": "API_LEVEL", "sourceType": "URL", "sourceUrl": "http://wiki.cdyne.com/index.php/Phone_Verification", "otherTypeName": null, "documentId": "4145df31-04f1-440c-8d08-68952874622c", "summary": "This is the URL for online documentation", "name": "Online Documentation", "type": "SAMPLES" } ], "next": "", "count": 2 }

Sample CURL

curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://localhost:9443/api/am/publisher/v0.13/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents"

Parameters

Type Name Description Schema Default
Path

apiId

required

**API ID** consisting of the **UUID** of the API. Using the **UUID** in the API call is recommended. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**.

String

Query

limit

optional

Maximum size of resource array to return.

Integer

25

Query

offset

optional

Starting point within the complete list of items qualified.

Integer

0

Header

Accept

optional

Media types acceptable for the response. Default is application/json.

String

application/json

Header

If-None-Match

optional

Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource (Will be supported in future).

String

Responses

HTTP Code Description Schema

200

OK. Document list is returned.

DocumentList

304

Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future).

404

Not Found. Requested API does not exist.

Error

406

Not Acceptable. The requested media type is not supported

Error

Add a new document to an API

POST https://apis.wso2.com/api/am/publisher/v0.13/apis/{apiId}/documents

This operation can be used to add a new documentation to an API. This operation only adds the metadata of a document. To add the actual content we need to use **Upload the content of an API document ** API once we obtain a document Id by this operation.

OAuth 2.0 Scope

apim:api_createi

Request

POST https://localhost:9443/api/am/publisher/v0.13/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 Content-Type: application/json { "visibility": "API_LEVEL", "sourceType": "INLINE", "sourceUrl": null, "otherTypeName": null, "summary": "This is a sample documentation", "name": "Introduction to PhoneVerification API", "type": "HOWTO" }

Response

HTTP/1.1 201 Created Location: https://localhost:9443/api/am/publisher/v0.13/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058 Content-Type: application/json { "visibility": "API_LEVEL", "sourceType": "INLINE", "sourceUrl": null, "otherTypeName": null, "documentId": "ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058", "summary": "This is a sample documentation", "name": "Introduction to PhoneVerification API", "type": "HOWTO" }

Sample CURL

curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/am/publisher/v0.13/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents"

Parameters

Type Name Description Schema Default
Path

apiId

required

**API ID** consisting of the **UUID** of the API. Using the **UUID** in the API call is recommended. The combination of the provider of the API, name of the API and the version is also accepted as a valid API ID. Should be formatted as **provider-name-version**.

String

Body

body

required

Document object that needs to be added

Document (Document)

Header

Content-Type

required

Media type of the entity in the body. Default is application/json.

String

application/json

Responses

HTTP Code Description Schema

201

Created. Successful response with the newly created Document object as entity in the body. Location header contains URL of newly added document.

Document

400

Bad Request. Invalid request or validation error

Error

415

Unsupported media type. The entity of the request was in a not supported format.