APIDocumentApi


Get document content

Downloads a FILE type document/get the inline content or source url of a certain document.\n

URL

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

HTTP Method

GET

Scope

apim:api_view

CURL Example

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

Sample 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

Parameters

Type Name Description Schema Default
Path

apiId

required

**API ID** consisting of the **UUID** of the API.\nThe combination of the provider of the API, name of the API and the version is also accepted as a valid API ID.\nShould be formatted as **provider-name-version**.\n

String

Path

documentId

required

**Document Identifier**\n

String

Header

Accept

optional

Media types acceptable for the response. Default is JSON.\n

String

JSON

Header

If-None-Match

optional

Validator for conditional requests; based on the ETag of the formerly retrieved\nvariant of the resourec.\n

String

Header

If-Modified-Since

optional

Validator for conditional requests; based on Last Modified header of the\nformerly retrieved variant of the resource.\n

String

Responses

HTTP Code Description Schema

200

OK.\nFile or inline content returned.\n

303

See Other.\nSource can be retrived from the URL specified at the Location header.\n

304

Not Modified.\nEmpty body because the client has already the latest version of the requested resource.\n

404

Not Found.\nRequested Document does not exist.\n

Error

406

Not Acceptable.\nThe requested media type is not supported\n

Error

Update API document content.

Upload a file to a document or add inline content to the document.\n\nDocument's source type should be **FILE** in order to upload a file to the document using **file** parameter.\nDocument's source type should be **INLINE** in order to add inline content to the document using **inlineContent** parameter.\n\nOnly one of **file** or **inlineContent** can be specified at one time.\n

URL

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

HTTP Method

POST

Scope

apim:api_create

CURL Example

curl -k -H "Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a" -F file=@"sample.pdf" -X POST "http://127.0.0.1:9763/api/am/publisher/v0.9/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content"

Sample Response

HTTP/1.1 201 Created Location: http://localhost:9763/api/am/publisher/v0.9/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/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" }

Parameters

Type Name Description Schema Default
Path

apiId

required

**API ID** consisting of the **UUID** of the API.\nThe combination of the provider of the API, name of the API and the version is also accepted as a valid API ID.\nShould be formatted as **provider-name-version**.\n

String

Path

documentId

required

**Document Identifier**\n

String

Header

Content-Type

required

Media type of the entity in the body. Default is JSON.\n

String

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.\n

String

Header

If-Unmodified-Since

optional

Validator for conditional requests; based on Last Modified header.\n

String

Responses

HTTP Code Description Schema

200

OK.\nDocument updated\n

Document

400

Bad Request.\nInvalid request or validation error.\n

Error

404

Not Found.\nThe resource to be updated does not exist.\n

Error

412

Precondition Failed.\nThe request has not been performed because one of the preconditions is not met.\n

Error

Delete an API Document

Delete a document of an API\n

URL

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

HTTP Method

DELETE

Scope

apim:api_create

CURL Example

curl -H "Authorization: Bearer b0982cd2aacd463ff5f63cd5ebe58f4a" -X DELETE http://127.0.0.1:9763/api/am/publisher/v0.9/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058

Sample Response

HTTP/1.1 200 OK

Parameters

Type Name Description Schema Default
Path

apiId

required

**API ID** consisting of the **UUID** of the API.\nThe combination of the provider of the API, name of the API and the version is also accepted as a valid API ID.\nShould be formatted as **provider-name-version**.\n

String

Path

documentId

required

**Document Identifier**\n

String

Header

If-Match

optional

Validator for conditional requests; based on ETag.\n

String

Header

If-Unmodified-Since

optional

Validator for conditional requests; based on Last Modified header.\n

String

Responses

HTTP Code Description Schema

200

OK.\nResource successfully deleted.\n

404

Not Found.\nResource to be deleted does not exist.\n

Error

412

Precondition Failed.\nThe request has not been performed because one of the preconditions is not met.\n

Error

Get an API Document

Get a particular document associated with an API.\n

URL

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

HTTP Method

GET

Scope

apim:api_view

CURL Example

curl -H "Authorization: Bearer b0982cd2aacd463ff5f63cd5ebe58f4a" "http://127.0.0.1:9763/api/am/publisher/v0.9/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5"

Sample 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" }

Parameters

Type Name Description Schema Default
Path

apiId

required

**API ID** consisting of the **UUID** of the API.\nThe combination of the provider of the API, name of the API and the version is also accepted as a valid API ID.\nShould be formatted as **provider-name-version**.\n

String

Path

documentId

required

**Document Identifier**\n

String

Header

Accept

optional

Media types acceptable for the response. Default is JSON.\n

String

JSON

Header

If-None-Match

optional

Validator for conditional requests; based on the ETag of the formerly retrieved\nvariant of the resourec.\n

String

Header

If-Modified-Since

optional

Validator for conditional requests; based on Last Modified header of the\nformerly retrieved variant of the resource.\n

String

Responses

HTTP Code Description Schema

200

OK.\nDocument returned.\n

Document

304

Not Modified.\nEmpty body because the client has already the latest version of the requested resource.\n

404

Not Found.\nRequested Document does not exist.\n

Error

406

Not Acceptable.\nThe requested media type is not supported\n

Error

Update an API Document

Update document details.\n

URL

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

HTTP Method

PUT

Scope

apim:api_create

CURL Example

curl -k -H "Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a" -H "Content-Type: application/json" -X PUT -d data.json "http://127.0.0.1:9763/api/am/publisher/v0.9/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents"

Sample Request

{ "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 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" }

Parameters

Type Name Description Schema Default
Path

apiId

required

**API ID** consisting of the **UUID** of the API.\nThe combination of the provider of the API, name of the API and the version is also accepted as a valid API ID.\nShould be formatted as **provider-name-version**.\n

String

Path

documentId

required

**Document Identifier**\n

String

Body

body

required

Document object that needs to be added\n

Document (Document)

Header

Content-Type

required

Media type of the entity in the body. Default is JSON.\n

String

JSON

Header

If-Match

optional

Validator for conditional requests; based on ETag.\n

String

Header

If-Unmodified-Since

optional

Validator for conditional requests; based on Last Modified header.\n

String

Responses

HTTP Code Description Schema

200

OK.\nDocument updated\n

Document

400

Bad Request.\nInvalid request or validation error.\n

Error

404

Not Found.\nThe resource to be updated does not exist.\n

Error

412

Precondition Failed.\nThe request has not been performed because one of the preconditions is not met.\n

Error

Get API Documents

Get a list of documents belonging to an API.\n

URL

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

HTTP Method

GET

Scope

apim:api_view

CURL Example

curl -H "Authorization: Bearer b0982cd2aacd463ff5f63cd5ebe58f4a" "http://127.0.0.1:9763/api/am/publisher/v0.9/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents"

Sample 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 }

Parameters

Type Name Description Schema Default
Path

apiId

required

**API ID** consisting of the **UUID** of the API.\nThe combination of the provider of the API, name of the API and the version is also accepted as a valid API ID.\nShould be formatted as **provider-name-version**.\n

String

Query

limit

optional

Maximum size of resource array to return.\n

Integer

25

Query

offset

optional

Starting point within the complete list of items qualified.\n

Integer

0

Header

Accept

optional

Media types acceptable for the response. Default is JSON.\n

String

JSON

Header

If-None-Match

optional

Validator for conditional requests; based on the ETag of the formerly retrieved\nvariant of the resourec.\n

String

Responses

HTTP Code Description Schema

200

OK.\nDocument list is returned.\n

DocumentList

304

Not Modified.\nEmpty body because the client has already the latest version of the requested resource.\n

404

Not Found.\nRequested API does not exist.\n

Error

406

Not Acceptable.\nThe requested media type is not supported\n

Error

Add a new document

Add a new document to an API\n

URL

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

HTTP Method

POST

Scope

apim:api_create

CURL Example

curl -H "Authorization: Bearer cdcc8cf6016ed10620edf3a1d3c5ef2b" -H "Content-Type: application/json" -X POST -d @data.json "http://127.0.0.1:9763/api/am/publisher/v0.9/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents"

Sample Request

{ "visibility": "API_LEVEL", "sourceType": "INLINE", "sourceUrl": null, "otherTypeName": null, "summary": "This is a sample documentation", "name": "Introduction to PhoneVerification API", "type": "HOWTO" }

Sample Response

HTTP/1.1 201 Created Location: http://localhost:9763/api/am/publisher/v0.9/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" }

Parameters

Type Name Description Schema Default
Path

apiId

required

**API ID** consisting of the **UUID** of the API.\nThe combination of the provider of the API, name of the API and the version is also accepted as a valid API ID.\nShould be formatted as **provider-name-version**.\n

String

Body

body

required

Document object that needs to be added\n

Document (Document)

Header

Content-Type

required

Media type of the entity in the body. Default is JSON.\n

String

JSON

Responses

HTTP Code Description Schema

201

Created.\nSuccessful response with the newly created Document object as entity in the body.\nLocation header contains URL of newly added document.\n

Document

400

Bad Request.\nInvalid request or validation error\n

Error

415

Unsupported media type.\nThe entity of the request was in a not supported format.\n