Document (Individual)


Get the content of an API document

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

This operation can be used to retrive the content of an API's document. The document can be of 3 types. In each cases responses are different. 1. **Inline type**: The content of the document will be retrieved in `text/plain` content type _Sample cURL_ : `curl -k -H "Authorization:Bearer 579f0af4-37be-35c7-81a4-f1f1e9ee7c51" -F inlineContent=@"docs.txt" -X POST "https://localhost:9443/api/am/publisher/v0.13/apis/995a4972-3178-4b17-a374-756e0e19127c/documents/43c2bcce-60e7-405f-bc36-e39c0c5e189e/content` 2. **FILE type**: The file will be downloaded with the related content type (eg. `application/pdf`) 3. **URL type**: The client will recieve the URL of the document as the Location header with the response with - `303 See Other`

OAuth 2.0 Scope

apim:api_viewi

Request

GET https://localhost:9443/api/am/publisher/v0.13/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a

Response

HTTP/1.1 200 OK Content-Disposition: attachment; filename="sample.pdf" Content-Type: application/octet-stream Content-Length: 7802 %PDF-1.4 %äüöß 2 0 obj <</Length 3 0 R/Filter/FlateDecode>> stream .. >> startxref 7279 %%EOF

Sample CURL

curl -k -H "Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a" "https://localhost:9443/api/am/publisher/v0.13/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content" > sample.pdf

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

Path

documentId

required

Document Identifier

String

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

Header

If-Modified-Since

optional

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

String

Responses

HTTP Code Description Schema

200

OK. File or inline content returned.

303

See Other. Source can be retrived from the URL specified at the Location header.

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 Document does not exist.

Error

406

Not Acceptable. The requested media type is not supported

Error

Upload the content of an API document

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

Thid operation can be used to upload a file or add inline content to an API document. **IMPORTANT:** * Either **file** or **inlineContent** form data parameters should be specified at one time. * Document's source type should be **FILE** in order to upload a file to the document using **file** parameter. * Document's source type should be **INLINE** in order to add inline content to the document using **inlineContent** parameter.

OAuth 2.0 Scope

apim:api_createi

Request

POST https://localhost:9443/api/am/publisher/v0.13/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/documents/b3a79270-02bb-4e39-9ac1-90ce8f6c84af/content Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 Content-Length: 8004 Content-Type: multipart/form-data; boundary=------------------------7b9a53f1ffa452b9 --------------------------7b9a53f1ffa452b9 Content-Disposition: form-data; name="file"; filename="sample.pdf" Content-Type: application/octet-stream [file content] --------------------------7b9a53f1ffa452b9--

Response

HTTP/1.1 201 Created Location: https://localhost:9443/api/am/publisher/v0.13/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/documents/b3a79270-02bb-4e39-9ac1-90ce8f6c84af/content Content-Type: application/json { "visibility":"API_LEVEL", "sourceType":"FILE", "sourceUrl":null, "otherTypeName":null, "documentId":"daf732d3-bda2-46da-b381-2c39d901ea61", "summary":"This is a sample documentation pdf", "name":"Introduction to PhoneVerification API PDF", "type":"HOWTO" }

Sample CURL

curl -k -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -F file=@"sample.pdf" -X POST "https://localhost:9443/api/am/publisher/v0.13/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content"

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

Path

documentId

required

Document Identifier

String

Header

Content-Type

required

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

String

application/json

Form

file

optional

Document to upload

File

Form

inlineContent

optional

Inline content of the document

String

Header

If-Match

optional

Validator for conditional requests; based on ETag (Will be supported in future).

String

Header

If-Unmodified-Since

optional

Validator for conditional requests; based on Last Modified header (Will be supported in future).

String

Responses

HTTP Code Description Schema

200

OK. Document updated

Document

400

Bad Request. Invalid request or validation error.

Error

404

Not Found. The resource to be updated does not exist.

Error

412

Precondition Failed. The request has not been performed because one of the preconditions is not met.

Error

Delete a document of an API

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

This operation can be used to delete a document associated with an API.

OAuth 2.0 Scope

apim:api_createi

Request

DELETE https://localhost:9443/api/am/publisher/v0.13/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058 Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8

Response

HTTP/1.1 200 OK

Sample CURL

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

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

Path

documentId

required

Document Identifier

String

Header

If-Match

optional

Validator for conditional requests; based on ETag (Will be supported in future).

String

Header

If-Unmodified-Since

optional

Validator for conditional requests; based on Last Modified header (Will be supported in future).

String

Responses

HTTP Code Description Schema

200

OK. Resource successfully deleted.

404

Not Found. Resource to be deleted does not exist.

Error

412

Precondition Failed. The request has not been performed because one of the preconditions is not met.

Error

Get a document of an API

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

This operation can be used to retrieve a particular document's metadata associated with an 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/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5 Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8

Response

HTTP/1.1 200 OK Content-Type: application/json { "visibility": "API_LEVEL", "sourceType": "INLINE", "sourceUrl": null, "otherTypeName": null, "documentId": "0bcb7f05-599d-4e1a-adce-5cb89bfe58d5", "summary": "This is a sample documentation", "name": "PhoneVerification API Documentation", "type": "HOWTO" }

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/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5"

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

Path

documentId

required

Document Identifier

String

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

Header

If-Modified-Since

optional

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

String

Responses

HTTP Code Description Schema

200

OK. Document returned.

Document

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 Document does not exist.

Error

406

Not Acceptable. The requested media type is not supported

Error

Update a document of an API

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

This operation can be used to update metadata of an API's document.

OAuth 2.0 Scope

apim:api_createi

Request

PUT https://localhost:9443/api/am/publisher/v0.13/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5 Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a Content-Type: application/json { "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" }

Response

HTTP/1.1 200 OK Content-Type: application/json { "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" }

Sample CURL

curl -k -H "Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a" -H "Content-Type: application/json" -X PUT -d data.json "https://localhost:9443/api/am/publisher/v0.13/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5"

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

Path

documentId

required

Document Identifier

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

Header

If-Match

optional

Validator for conditional requests; based on ETag (Will be supported in future).

String

Header

If-Unmodified-Since

optional

Validator for conditional requests; based on Last Modified header (Will be supported in future).

String

Responses

HTTP Code Description Schema

200

OK. Document updated

Document

400

Bad Request. Invalid request or validation error.

Error

404

Not Found. The resource to be updated does not exist.

Error

412

Precondition Failed. The request has not been performed because one of the preconditions is not met.

Error