From 61bc681ea89a4daa053c012554698f94ab4ff134 Mon Sep 17 00:00:00 2001 From: chashikajw Date: Mon, 9 Oct 2023 08:06:52 +0530 Subject: [PATCH] Revamp devportal-api yaml with new scopes --- .../ballerina/BusinessPlan.bal | 21 - .../ballerina/backoffice-api_service.bal | 24 +- .../ballerina/backoffice_dao.bal | 91 +- .../ballerina/backoffice_impl.bal | 51 +- .../ballerina/resources/devportal-api.yaml | 779 ++---------------- .../ballerina/types.bal | 81 +- 6 files changed, 107 insertions(+), 940 deletions(-) delete mode 100644 backoffice/backoffice-domain-service/ballerina/BusinessPlan.bal diff --git a/backoffice/backoffice-domain-service/ballerina/BusinessPlan.bal b/backoffice/backoffice-domain-service/ballerina/BusinessPlan.bal deleted file mode 100644 index 9d5e00096..000000000 --- a/backoffice/backoffice-domain-service/ballerina/BusinessPlan.bal +++ /dev/null @@ -1,21 +0,0 @@ -public type BusinessPlanDAO record { - *Policy; - *GraphQLQuery; - string defaulLimitType; - # Unit of the time. Allowed values are "sec", "min", "hour", "day" - string timeUnit; - # Time limit that the throttling limit applies. - int unitTime; - int quota; - # Unit of data allowed to be transfered. Allowed values are "KB", "MB" and "GB" - string dataUnit?; - # Burst control request count - int rateLimitCount?; - # Burst control time unit - string rateLimitTimeUnit?; - # Number of subscriptions allowed - int subscriberCount?; - # Custom attributes added to the Subscription Throttling Policy - CustomAttribute[] customAttributes?; - BusinessPlanPermission permissions?; -}; \ No newline at end of file diff --git a/backoffice/backoffice-domain-service/ballerina/backoffice-api_service.bal b/backoffice/backoffice-domain-service/ballerina/backoffice-api_service.bal index 7263d746d..ac94f5317 100644 --- a/backoffice/backoffice-domain-service/ballerina/backoffice-api_service.bal +++ b/backoffice/backoffice-domain-service/ballerina/backoffice-api_service.bal @@ -46,7 +46,7 @@ service http:InterceptableService /api/backoffice on ep0 { http:Interceptor[] interceptors = [jwtValidationInterceptor, requestErrorInterceptor, responseErrorInterceptor]; return interceptors; } - isolated resource function get apis(http:RequestContext requestContext, string? query, @http:Header string? 'if\-none\-match, int 'limit = 25, int offset = 0, string sortBy = "createdTime", string sortOrder = "desc", @http:Header string? accept = "application/json") returns APIList|http:NotModified|commons:APKError { + isolated resource function get apis(http:RequestContext requestContext, string? query, @http:Header string? 'if\-none\-match, int 'limit = 25, int offset = 0, "apiName"|"version"|"createdTime"|"status" sortBy = "createdTime", string sortOrder = "desc", @http:Header string? accept = "application/json") returns APIList|http:NotModified|commons:APKError { commons:UserContext authenticatedUserContext = check commons:getAuthenticatedUserContext(requestContext); commons:Organization organization = authenticatedUserContext.organization; return getAPIList('limit, offset, query, organization.uuid); @@ -66,8 +66,6 @@ service http:InterceptableService /api/backoffice on ep0 { } return apiDefinition; } - // resource function get apis/[string apiId]/'resource\-paths(@http:Header string? 'if\-none\-match, int 'limit = 25, int offset = 0) returns ResourcePathList|http:NotModified|NotFoundError|NotAcceptableError { - // } isolated resource function get apis/[string apiId]/thumbnail(@http:Header string? 'if\-none\-match, @http:Header string? accept = "application/json") returns http:Response|http:NotModified|NotFoundError|NotAcceptableError|commons:APKError { return getThumbnail(apiId); } @@ -77,18 +75,11 @@ service http:InterceptableService /api/backoffice on ep0 { resource function get apis/[string apiId]/documents(@http:Header string? 'if\-none\-match, int 'limit = 25, int offset = 0, @http:Header string? accept = "application/json") returns DocumentList|http:NotModified|NotFoundError|NotAcceptableError|commons:APKError { return getDocumentList(apiId, 'limit, offset); } - isolated resource function post apis/[string apiId]/documents(@http:Payload Document payload) returns CreatedDocument|BadRequestError|UnsupportedMediaTypeError|commons:APKError|error { + isolated resource function post apis/[string apiId]/documents(@http:Payload Document payload) returns Document|BadRequestError|UnsupportedMediaTypeError|commons:APKError|error { Document documentBody = check payload.cloneWithType(Document); Document|commons:APKError createdDocument = createDocument(apiId, documentBody); - if createdDocument is Document { - CreatedDocument createdDoc = { - body: createdDocument - }; - return createdDoc; - } else { - return createdDocument; - } + return createdDocument; } resource function get apis/[string apiId]/documents/[string documentId](@http:Header string? 'if\-none\-match, @http:Header string? accept = "application/json") returns Document|http:NotModified|NotFoundError|NotAcceptableError|commons:APKError { return getDocumentMetaData(apiId, documentId); @@ -174,13 +165,4 @@ service http:InterceptableService /api/backoffice on ep0 { return error("Error while getting LC state of API" + currentState.message()); } } - resource function get 'business\-plans(http:RequestContext requestContext, @http:Header string? accept = "application/json") returns BusinessPlanList|commons:APKError { - commons:UserContext authenticatedUserContext = check commons:getAuthenticatedUserContext(requestContext); - commons:Organization organization = authenticatedUserContext.organization; - BusinessPlanList|commons:APKError subPolicyList = getBusinessPlans(organization.uuid); - if subPolicyList is BusinessPlanList { - log:printDebug(subPolicyList.toString()); - } - return subPolicyList; - } } diff --git a/backoffice/backoffice-domain-service/ballerina/backoffice_dao.bal b/backoffice/backoffice-domain-service/ballerina/backoffice_dao.bal index 1959f11ed..871bf59ad 100644 --- a/backoffice/backoffice-domain-service/ballerina/backoffice_dao.bal +++ b/backoffice/backoffice-domain-service/ballerina/backoffice_dao.bal @@ -23,7 +23,7 @@ import ballerina/io; import wso2/apk_common_lib as commons; import ballerina/log; -isolated function db_getAPIsDAO(string organization) returns API[]|commons:APKError { +isolated function db_getAPIsDAO(string organization) returns APIInfo[]|commons:APKError { postgresql:Client|error db_Client = getConnection(); if db_Client is error { return e909601(db_Client); @@ -32,8 +32,8 @@ isolated function db_getAPIsDAO(string organization) returns API[]|commons:APKEr sql:ParameterizedQuery GET_API = `SELECT UUID AS ID, API_NAME as NAME, API_VERSION as VERSION,CONTEXT, ORGANIZATION, STATUS as STATE, string_to_array(SDK::text,',')::text[] AS SDK,string_to_array(API_TIER::text,',') AS POLICIES, ARTIFACT as ARTIFACT FROM API where ORGANIZATION = ${organization}`; - stream apisStream = db_Client->query(GET_API); - API[] apis = check from API api in apisStream + stream apisStream = db_Client->query(GET_API); + APIInfo[] apis = check from APIInfo api in apisStream select api; check apisStream.close(); return apis; @@ -159,9 +159,9 @@ isolated function db_getSubscriptionsForAPI(string apiId) returns Subscription[] Subscription[] subsList = []; check from Subscriptions subitem in result1 do { - Subscription sub = {applicationInfo: {}, subscriptionId: "", subscriptionStatus: "", usagePlan: ""}; + Subscription sub = {applicationInfo: {}, subscriptionId: "", subscriptionStatus: <"BLOCKED"|"PROD_ONLY_BLOCKED"|"UNBLOCKED"|"ON_HOLD"|"REJECTED"|"TIER_UPDATE_PENDING"|"DELETE_PENDING">"", usagePlan: ""}; sub.subscriptionId = subitem.subscriptionId; - sub.subscriptionStatus = subitem.subscriptionStatus; + sub.subscriptionStatus = <"BLOCKED"|"PROD_ONLY_BLOCKED"|"UNBLOCKED"|"ON_HOLD"|"REJECTED"|"TIER_UPDATE_PENDING"|"DELETE_PENDING">subitem.subscriptionStatus; sub.applicationInfo.applicationId = subitem.applicationId; sub.usagePlan = subitem.usagePlan; sub.applicationInfo.name = subitem.name; @@ -332,7 +332,7 @@ isolated function getAPICategoriesDAO(string org) returns APICategory[]|commons: } } -isolated function getAPIsByQueryDAO(string payload, string org) returns API[]|commons:APKError { +isolated function getAPIsByQueryDAO(string payload, string org) returns APIInfo[]|commons:APKError { postgresql:Client|error dbClient = getConnection(); if dbClient is error { return e909601(dbClient); @@ -342,8 +342,8 @@ isolated function getAPIsByQueryDAO(string payload, string org) returns API[]|co API_NAME as NAME, API_VERSION as VERSION,CONTEXT, ORGANIZATION,STATUS, ARTIFACT as ARTIFACT FROM API JOIN JSONB_EACH_TEXT(ARTIFACT) e ON true WHERE e.value LIKE ${payload} AND ORGANIZATION = ${org}`; - stream apisStream = dbClient->query(query); - API[] apis = check from API api in apisStream + stream apisStream = dbClient->query(query); + APIInfo[] apis = check from APIInfo api in apisStream select api; check apisStream.close(); return apis; @@ -354,81 +354,6 @@ isolated function getAPIsByQueryDAO(string payload, string org) returns API[]|co } } -public isolated function getBusinessPlansDAO(string org) returns BusinessPlan[]|commons:APKError { - postgresql:Client|error dbClient = getConnection(); - if dbClient is error { - return e909601(dbClient); - } else { - do { - sql:ParameterizedQuery query = `SELECT NAME as PLANNAME, DISPLAY_NAME as DISPLAYNAME, DESCRIPTION, - UUID as PLANID, IS_DEPLOYED as ISDEPLOYED, - QUOTA_TYPE as DefaulLimitType, QUOTA , TIME_UNIT as TIMEUNIT, UNIT_TIME as - UNITTIME, RATE_LIMIT_COUNT as RATELIMITCOUNT, RATE_LIMIT_TIME_UNIT as RATELIMITTIMEUNIT FROM BUSINESS_PLAN WHERE ORGANIZATION =${org}`; - stream businessPlanStream = dbClient->query(query); - BusinessPlanDAO[] businessPlansDAO = check from BusinessPlanDAO businessPlan in businessPlanStream - select businessPlan; - check businessPlanStream.close(); - BusinessPlan[] businessPlans = []; - if businessPlansDAO is BusinessPlanDAO[] { - foreach BusinessPlanDAO result in businessPlansDAO { - if result.defaulLimitType == "requestCount" { - BusinessPlan bp = { - planName: result.planName, - displayName: result.displayName, - description: result.description, - planId: result.planId, - isDeployed: result.isDeployed, - rateLimitCount: result.rateLimitCount, - rateLimitTimeUnit: result.rateLimitTimeUnit, - defaultLimit: { - 'type: result.defaulLimitType, - requestCount: - {requestCount: result.quota, timeUnit: result.timeUnit, unitTime: result.unitTime} - } - }; - businessPlans.push(bp); - } else if result.defaulLimitType == "bandwidth" { - BusinessPlan bp = { - planName: result.planName, - displayName: result.displayName, - description: result.description, - planId: result.planId, - isDeployed: result.isDeployed, - rateLimitCount: result.rateLimitCount, - rateLimitTimeUnit: result.rateLimitTimeUnit, - defaultLimit: { - 'type: result.defaulLimitType, - bandwidth: - {dataAmount: result.quota, dataUnit: result.dataUnit, timeUnit: result.timeUnit, unitTime: result.unitTime} - } - }; - businessPlans.push(bp); - } else { - BusinessPlan bp = { - planName: result.planName, - displayName: result.displayName, - description: result.description, - planId: result.planId, - isDeployed: result.isDeployed, - rateLimitCount: result.rateLimitCount, - rateLimitTimeUnit: result.rateLimitTimeUnit, - defaultLimit: { - 'type: result.defaulLimitType, - eventCount: - {eventCount: result.quota, timeUnit: result.timeUnit, unitTime: result.unitTime} - } - }; - businessPlans.push(bp); - } - } - } - return businessPlans; - } on fail var e { - return e909620(e); - } - } -} - isolated function db_getResourceByResourceCategory(string apiId, int resourceCategoryId) returns Resource|NotFoundError|commons:APKError { postgresql:Client|error db_Client = getConnection(); if db_Client is error { diff --git a/backoffice/backoffice-domain-service/ballerina/backoffice_impl.bal b/backoffice/backoffice-domain-service/ballerina/backoffice_impl.bal index 698eebd44..9aaa6eec2 100644 --- a/backoffice/backoffice-domain-service/ballerina/backoffice_impl.bal +++ b/backoffice/backoffice-domain-service/ballerina/backoffice_impl.bal @@ -29,9 +29,9 @@ import ballerina/mime; # + return - Return Value string?|APIList|error isolated function getAPIList(int 'limit, int offset, string? query, string organization) returns APIList|commons:APKError { if query !is string { - API[]|commons:APKError apis = db_getAPIsDAO(organization); - if apis is API[] { - API[] limitSet = []; + APIInfo[]|commons:APKError apis = db_getAPIsDAO(organization); + if apis is APIInfo[] { + APIInfo[] limitSet = []; if apis.length() > offset { foreach int i in offset ... (apis.length() - 1) { if limitSet.length() < 'limit { @@ -50,9 +50,9 @@ isolated function getAPIList(int 'limit, int offset, string? query, string organ int? index = query.indexOf(":"); if index is int { string modifiedQuery = "%" + query.substring(index + 1) + "%"; - API[]|commons:APKError apis = getAPIsByQueryDAO(modifiedQuery, organization); - if apis is API[] { - API[] limitSet = []; + APIInfo[]|commons:APKError apis = getAPIsByQueryDAO(modifiedQuery, organization); + if apis is APIInfo[] { + APIInfo[] limitSet = []; if apis.length() > offset { foreach int i in offset ... (apis.length() - 1) { if limitSet.length() < 'limit { @@ -307,17 +307,6 @@ isolated function getAllCategoryList(string organization) returns APICategoryLis } } -isolated function getBusinessPlans(string organization) returns BusinessPlanList|commons:APKError { - BusinessPlan[]|commons:APKError businessPlans = getBusinessPlansDAO(organization); - if businessPlans is BusinessPlan[] { - int count = businessPlans.length(); - BusinessPlanList BusinessPlansList = {count: count, list: businessPlans}; - return BusinessPlansList; - } else { - return businessPlans; - } -} - isolated function retrieveManagementServerHostsList() returns string[]|commons:APKError { string managementServerServiceName = managementServerConfig.serviceName; string managementServerNamespace = managementServerConfig.namespace; @@ -450,7 +439,7 @@ isolated function createDocument(string apiId, Document documentPayload) returns sourceType: documentPayload.sourceType, sourceUrl: documentPayload.sourceUrl, fileName: documentPayload.fileName, - documentType: documentPayload.documentType, + documentType: documentPayload.documentType ?: "HOWTO", otherTypeName: documentPayload.otherTypeName, visibility: documentPayload.visibility, inlineContent: documentPayload.inlineContent @@ -461,12 +450,12 @@ isolated function createDocument(string apiId, Document documentPayload) returns documentId: addedDocMetaData.documentId, name: addedDocMetaData.name, summary: addedDocMetaData.summary, - sourceType: addedDocMetaData.sourceType, + sourceType: <"INLINE"|"MARKDOWN"|"URL"|"FILE">addedDocMetaData.sourceType, sourceUrl: addedDocMetaData.sourceUrl, fileName: addedDocMetaData.fileName, - documentType: addedDocMetaData.documentType, + documentType: <"HOWTO"|"SAMPLES"|"PUBLIC_FORUM"|"SUPPORT_FORUM"|"API_MESSAGE_FORMAT"|"SWAGGER_DOC"|"OTHER">addedDocMetaData.documentType, otherTypeName: addedDocMetaData.otherTypeName, - visibility: addedDocMetaData.visibility, + visibility: <"OWNER_ONLY"|"PRIVATE"|"API_LEVEL">addedDocMetaData.visibility, inlineContent: addedDocMetaData.inlineContent }; return document; @@ -496,7 +485,7 @@ isolated function UpdateDocumentMetaData(string apiId, string documentId, Docume sourceType: documentPayload.sourceType, sourceUrl: documentPayload.sourceUrl, fileName: documentPayload.fileName, - documentType: documentPayload.documentType, + documentType: documentPayload.documentType ?: "HOWTO", otherTypeName: documentPayload.otherTypeName, visibility: documentPayload.visibility, inlineContent: documentPayload.inlineContent @@ -508,12 +497,12 @@ isolated function UpdateDocumentMetaData(string apiId, string documentId, Docume documentId: updatedDocMetaData.documentId, name: updatedDocMetaData.name, summary: updatedDocMetaData.summary, - sourceType: updatedDocMetaData.sourceType, + sourceType: <"INLINE"|"MARKDOWN"|"URL"|"FILE">updatedDocMetaData.sourceType, sourceUrl: updatedDocMetaData.sourceUrl, fileName: updatedDocMetaData.fileName, - documentType: updatedDocMetaData.documentType, + documentType: <"HOWTO"|"SAMPLES"|"PUBLIC_FORUM"|"SUPPORT_FORUM"|"API_MESSAGE_FORMAT"|"SWAGGER_DOC"|"OTHER">updatedDocMetaData.documentType, otherTypeName: updatedDocMetaData.otherTypeName, - visibility: updatedDocMetaData.visibility, + visibility: <"OWNER_ONLY"|"PRIVATE"|"API_LEVEL">updatedDocMetaData.visibility, inlineContent: updatedDocMetaData.inlineContent }; return document; @@ -538,12 +527,12 @@ isolated function addDocumentContent(string apiId, string documentId, http:Reque documentId: getDocumentMetaData.documentId, name: getDocumentMetaData.name, summary: getDocumentMetaData.summary, - sourceType: getDocumentMetaData.sourceType, + sourceType: <"INLINE"|"MARKDOWN"|"URL"|"FILE">getDocumentMetaData.sourceType, sourceUrl: getDocumentMetaData.sourceUrl, fileName: getDocumentMetaData.fileName, - documentType: getDocumentMetaData.documentType, + documentType: <"HOWTO"|"SAMPLES"|"PUBLIC_FORUM"|"SUPPORT_FORUM"|"API_MESSAGE_FORMAT"|"SWAGGER_DOC"|"OTHER">getDocumentMetaData.documentType, otherTypeName: getDocumentMetaData.otherTypeName, - visibility: getDocumentMetaData.visibility, + visibility: <"OWNER_ONLY"|"PRIVATE"|"API_LEVEL">getDocumentMetaData.visibility, inlineContent: getDocumentMetaData.inlineContent }; byte[]|() fileContent = (); @@ -633,12 +622,12 @@ isolated function getDocumentMetaData(string apiId, string documentId) returns D documentId: getDocumentMetaData.documentId, name: getDocumentMetaData.name, summary: getDocumentMetaData.summary, - sourceType: getDocumentMetaData.sourceType, + sourceType: <"INLINE"|"MARKDOWN"|"URL"|"FILE">getDocumentMetaData.sourceType, sourceUrl: getDocumentMetaData.sourceUrl, fileName: getDocumentMetaData.fileName, - documentType: getDocumentMetaData.documentType, + documentType: <"HOWTO"|"SAMPLES"|"PUBLIC_FORUM"|"SUPPORT_FORUM"|"API_MESSAGE_FORMAT"|"SWAGGER_DOC"|"OTHER">getDocumentMetaData.documentType, otherTypeName: getDocumentMetaData.otherTypeName, - visibility: getDocumentMetaData.visibility, + visibility: <"OWNER_ONLY"|"PRIVATE"|"API_LEVEL">getDocumentMetaData.visibility, inlineContent: getDocumentMetaData.inlineContent }; return document; diff --git a/devportal/devportal-domain-service/ballerina/resources/devportal-api.yaml b/devportal/devportal-domain-service/ballerina/resources/devportal-api.yaml index c068c5bb0..d9a5cff3b 100644 --- a/devportal/devportal-domain-service/ballerina/resources/devportal-api.yaml +++ b/devportal/devportal-domain-service/ballerina/resources/devportal-api.yaml @@ -64,7 +64,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis" + source: curl -k "https://api.am.wso2.com:9095/api/am/devportal/apis" /apis/{apiId}: get: @@ -109,7 +109,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis/c43a325c-260b-4302-81cb-768eafaa3aed" + source: curl -k "https://api.am.wso2.com:9095/api/am/devportal/apis/c43a325c-260b-4302-81cb-768eafaa3aed" /apis/{apiId}/definition: get: @@ -196,11 +196,11 @@ paths: $ref: '#/components/responses/InternalServerError' security: - OAuth2Security: - - apk:subscribe + - [] x-code-samples: - lang: Curl source: curl -k -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/sdks/java" + "https://api.am.wso2.com:9095/api/am/devportal/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/sdks/java" > Petstore_java_1.0.0.zip ###################################################### @@ -246,7 +246,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis/c43a325c-260b-4302-81cb-768eafaa3aed/documents" + source: curl -k "https://api.am.wso2.com:9095/api/am/devportal/apis/c43a325c-260b-4302-81cb-768eafaa3aed/documents" ###################################################### # The "Individual Document" resource APIs @@ -290,7 +290,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis/c43a325c-260b-4302-81cb-768eafaa3aed/documents/850a4f34-db2c-4d23-9d85-3f95fbfb082c" + source: curl -k "https://api.am.wso2.com:9095/api/am/devportal/apis/c43a325c-260b-4302-81cb-768eafaa3aed/documents/850a4f34-db2c-4d23-9d85-3f95fbfb082c" /apis/{apiId}/documents/{documentId}/content: get: @@ -343,7 +343,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5/content" + source: curl -k "https://api.am.wso2.com:9095/api/am/devportal/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5/content" /apis/{apiId}/thumbnail: get: @@ -389,7 +389,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: 'curl -k "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/thumbnail" > image.jpeg' + source: 'curl -k "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/thumbnail" > image.jpeg' /apis/{apiId}/ratings: get: @@ -417,7 +417,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/ratings" + source: curl -k "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/ratings" /apis/{apiId}/user-rating: get: @@ -463,7 +463,7 @@ paths: x-code-samples: - lang: Curl source: curl -k -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/user-rating" + "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/user-rating" put: tags: @@ -502,11 +502,11 @@ paths: $ref: '#/components/responses/UnsupportedMediaType' security: - OAuth2Security: - - apk:subscribe + - [] x-code-samples: - lang: Curl source: 'curl -k -X PUT -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -d @data.json "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/user-rating"' + -H "Content-Type: application/json" -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/user-rating"' delete: tags: @@ -525,11 +525,11 @@ paths: content: {} security: - OAuth2Security: - - apk:subscribe + - [] x-code-samples: - lang: Curl source: curl -k -X DELETE -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/user-rating" + "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/user-rating" /apis/{apiId}/comments: get: @@ -561,7 +561,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments" + source: curl -k "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments" post: tags: @@ -624,12 +624,11 @@ paths: 500: $ref: '#/components/responses/InternalServerError' security: - - OAuth2Security: - - apk:subscribe + - OAuth2Security: [] x-code-samples: - lang: Curl source: 'curl -k -X POST -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -d @data.json "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments"' + -H "Content-Type: application/json" -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments"' /apis/{apiId}/comments/{commentId}: get: @@ -678,7 +677,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4" + source: curl -k "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4" patch: tags: @@ -749,7 +748,7 @@ paths: x-code-samples: - lang: Curl source: 'curl -k -X PATCH -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -d @data.json "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4"' + -H "Content-Type: application/json" -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4"' delete: tags: @@ -784,11 +783,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:admin # special scope added to moderate comments x-code-samples: - lang: Curl source: curl -k -X DELETE -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4" + "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4" /apis/{apiId}/comments/{commentId}/replies: get: @@ -837,88 +835,8 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4/replies" - - /apis/{apiId}/topics: - get: - tags: - - Topics - summary: | - Get a list of available topics for a given Async API - description: | - This operation will provide a list of topics available for a given Async API, based on the provided API ID. - parameters: - - $ref: '#/components/parameters/apiId' - - $ref: '#/components/parameters/requestedTenant' - responses: - 200: - description: | - OK. Topic list returned. - headers: - ETag: - description: | - Entity Tag of the response resource. Used by caches, or in conditional requests. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/TopicList' - 404: - $ref: '#/components/responses/NotFound' - 500: - $ref: '#/components/responses/InternalServerError' - security: - - OAuth2Security: [] - x-code-samples: - - lang: Curl - source: curl -k -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/apis/5b65808c-cdf2-43e1-a695-de63e3ad0ae9/topics" + source: curl -k -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://api.am.wso2.com:9095/api/am/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/comments/d4cf1704-5d09-491c-bc48-4d19ce6ea9b4/replies" - /apis/{apiId}/subscription-policies: - get: - tags: - - APIs - summary: | - Get Details of the Subscription Throttling Policies of an API - description: | - This operation can be used to retrieve details of the subscription throttling policy of an API by specifying the API Id. - parameters: - - $ref: '#/components/parameters/apiId' - - $ref: '#/components/parameters/requestedTenant' - - $ref: '#/components/parameters/If-None-Match' - responses: - 200: - description: | - OK. Throttling Policy returned - headers: - ETag: - description: | - Entity Tag of the response resource. Used by caches, or in conditional requests. - schema: - type: string - Last-Modified: - description: | - Date and time the resource has been modified the last time. Used by caches, or in conditional requests. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/ThrottlingPolicy' - 304: - description: | - Not Modified. Empty body because the client has already the latest version of the requested resource. - content: {} - 404: - $ref: '#/components/responses/NotFound' - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: [] - x-code-samples: - - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis/268c9e55-3dc1-4f47-82e7-977e5343d077/subscription-policies" ###################################################### # The "Application Collection" resource APIs @@ -982,12 +900,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage - - apk:app_import_export x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/applications?query=CalculatorApp"' + "https://api.am.wso2.com:9095/api/am/devportal/applications?query=CalculatorApp"' post: tags: @@ -1045,11 +961,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/devportal/applications"' + -H "Content-Type: application/json" -X POST -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/applications"' ###################################################### # The "Individual Application" resource APIs @@ -1096,11 +1011,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/applications/896658a0-b4ee-4535-bbfa-806c894a4015"' + "https://api.am.wso2.com:9095/api/am/devportal/applications/896658a0-b4ee-4535-bbfa-806c894a4015"' put: tags: @@ -1153,11 +1067,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X PUT -d @data.json "https://localhost:9443/api/devportal/applications/896658a0-b4ee-4535-bbfa-806c894a4015"' + -H "Content-Type: application/json" -X PUT -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/applications/896658a0-b4ee-4535-bbfa-806c894a4015"' delete: tags: @@ -1194,12 +1107,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage - - apk:app_import_export x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -X DELETE "https://localhost:9443/api/devportal/applications/896658a0-b4ee-4535-bbfa-806c894a4015"' + -X DELETE "https://api.am.wso2.com:9095/api/am/devportal/applications/896658a0-b4ee-4535-bbfa-806c894a4015"' /applications/{applicationId}/generate-keys: post: @@ -1236,11 +1147,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/devportal/applications/896658a0-b4ee-4535-bbfa-806c894a4015/generate-keys"' + -H "Content-Type: application/json" -X POST -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/applications/896658a0-b4ee-4535-bbfa-806c894a4015/generate-keys"' /applications/{applicationId}/map-keys: post: @@ -1277,11 +1187,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/devportal/applications/896658a0-b4ee-4535-bbfa-806c894a4015/map-keys"' + -H "Content-Type: application/json" -X POST -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/applications/896658a0-b4ee-4535-bbfa-806c894a4015/map-keys"' /applications/{applicationId}/oauth-keys: @@ -1311,11 +1220,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys"' + "https://api.am.wso2.com:9095/api/am/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys"' /applications/{applicationId}/oauth-keys/{keyMappingId}: get: @@ -1345,11 +1253,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/df972173-c957-46d4-96ac-99be8e303584"' + "https://api.am.wso2.com:9095/api/am/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/df972173-c957-46d4-96ac-99be8e303584"' put: tags: @@ -1386,11 +1293,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X PUT -d @data.json "https://localhost:9443/api/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/df972173-c957-46d4-96ac-99be8e303584"' + -H "Content-Type: application/json" -X PUT -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/df972173-c957-46d4-96ac-99be8e303584"' /applications/{applicationId}/oauth-keys/{keyMappingId}/regenerate-secret: post: @@ -1436,11 +1342,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST "https://localhost:9443/api/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/df972173-c957-46d4-96ac-99be8e303584/regenerate-secret"' + -H "Content-Type: application/json" -X POST "https://api.am.wso2.com:9095/api/am/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/df972173-c957-46d4-96ac-99be8e303584/regenerate-secret"' /applications/{applicationId}/oauth-keys/{keyMappingId}/clean-up: post: @@ -1467,11 +1372,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST "https://localhost:9443/api/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/df972173-c957-46d4-96ac-99be8e303584/clean-up"' + -H "Content-Type: application/json" -X POST "https://api.am.wso2.com:9095/api/am/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/df972173-c957-46d4-96ac-99be8e303584/clean-up"' /applications/{applicationId}/oauth-keys/{keyMappingId}/generate-token: post: @@ -1509,11 +1413,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/{keyMappingId}/generate-token"' + -H "Content-Type: application/json" -X POST -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/oauth-keys/{keyMappingId}/generate-token"' /applications/{applicationId}/api-keys/{keyType}/generate: post: @@ -1551,12 +1454,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage - - apk:api_key x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/api-keys/PRODUCTION/generate"' + -H "Content-Type: application/json" -X POST -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/api-keys/PRODUCTION/generate"' /applications/{applicationId}/api-keys/{keyType}/revoke: post: @@ -1589,164 +1490,11 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:app_manage - - apk:api_key x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/api-keys/PRODUCTION/revoke"' + -H "Content-Type: application/json" -X POST -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/applications/16cd2684-9657-4a01-a956-4efd89e96077/api-keys/PRODUCTION/revoke"' - /applications/export: - get: - tags: - - Import Export - summary: Export an Application - description: | - This operation can be used to export the details of a particular application as a zip file. - parameters: - - name: appName - in: query - description: | - Application Name - required: true - schema: - type: string - - name: appOwner - in: query - description: | - Owner of the Application - required: true - schema: - type: string - - name: withKeys - in: query - description: | - Export application keys - schema: - type: boolean - - name: format - in: query - description: | - Format of output documents. Can be YAML or JSON. - schema: - type: string - enum: - - JSON - - YAML - responses: - 200: - description: | - OK. Export Successful. - headers: - Content-Type: - description: | - The content type of the body. - schema: - type: string - content: - application/zip: - schema: - type: string - format: binary - 400: - $ref: '#/components/responses/BadRequest' - 404: - $ref: '#/components/responses/NotFound' - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: - - apk:app_import_export - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/applications/export?appName=sampleApp&appOwner=admin&withKeys=true" - > exportedApplication.zip' - - /applications/import: - post: - tags: - - Import Export - summary: Import an Application - description: | - This operation can be used to import an application. - parameters: - - name: preserveOwner - in: query - description: | - Preserve Original Creator of the Application - schema: - type: boolean - - name: skipSubscriptions - in: query - description: | - Skip importing Subscriptions of the Application - schema: - type: boolean - - name: appOwner - in: query - description: | - Expected Owner of the Application in the Import Environment - schema: - type: string - - name: skipApplicationKeys - in: query - description: | - Skip importing Keys of the Application - schema: - type: boolean - - name: update - in: query - description: | - Update if application exists - schema: - type: boolean - requestBody: - content: - multipart/form-data: - schema: - required: - - file - properties: - file: - type: string - description: | - Zip archive consisting of exported Application Configuration. - format: binary - required: true - responses: - 200: - description: | - OK. Successful response with the updated object information as entity in the body. - headers: - Content-Type: - description: | - The content type of the body. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/ApplicationInfo' - # 207: - # description: | - # Multi Status. - # Partially successful response with skipped APIs information object as entity in the body. - # content: - # application/json: - # schema: - # $ref: '#/components/schemas/APIInfoList' - 400: - $ref: '#/components/responses/BadRequest' - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: - - apk:app_import_export - x-code-samples: - - lang: Curl - source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -F file=@exportedApplication.zip "https://127.0.0.1:9443/api/devportal/applications/import?preserveOwner=true&skipSubscriptions=false&appOwner=admin&skipApplicationKeys=false&update=true"' ###################################################### # The "Subscription Collection" resource APIs @@ -1790,11 +1538,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:sub_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/subscriptions?apiId=02e658e7-71c7-4b1d-a623-be145b789340"' + "https://api.am.wso2.com:9095/api/am/devportal/subscriptions?apiId=02e658e7-71c7-4b1d-a623-be145b789340"' post: tags: @@ -1856,11 +1603,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:sub_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/devportal/subscriptions"' + -H "Content-Type: application/json" -X POST -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/subscriptions"' /subscriptions/multiple: post: @@ -1917,11 +1663,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:sub_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/devportal/subscriptions/multiple"' + -H "Content-Type: application/json" -X POST -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/subscriptions/multiple"' ###################################################### # The "Subscriptions related to API" resource API @@ -1964,7 +1709,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://localhost:9443/api/devportal/subscriptions/e93fb282-b456-48fc-8981-003fb89086ae/additionalInfo"' + source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://api.am.wso2.com:9095/api/am/devportal/subscriptions/e93fb282-b456-48fc-8981-003fb89086ae/additionalInfo"' ###################################################### # The "Individual Subscription" resource APIs @@ -2006,11 +1751,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:sub_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/subscriptions/5b65808c-cdf2-43e1-a695-de63e3ad0ae9"' + "https://api.am.wso2.com:9095/api/am/devportal/subscriptions/5b65808c-cdf2-43e1-a695-de63e3ad0ae9"' put: tags: @@ -2079,11 +1823,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:sub_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X PUT -d @data.json "https://localhost:9443/api/devportal/subscriptions/80369180-7d90-4ee8-99a1-19fa68512aa5"' + -H "Content-Type: application/json" -X PUT -d @data.json "https://api.am.wso2.com:9095/api/am/devportal/subscriptions/80369180-7d90-4ee8-99a1-19fa68512aa5"' delete: tags: @@ -2120,11 +1863,10 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:sub_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X DELETE "https://localhost:9443/api/devportal/subscriptions/80369180-7d90-4ee8-99a1-19fa68512aa5"' + -H "Content-Type: application/json" -X DELETE "https://api.am.wso2.com:9095/api/am/devportal/subscriptions/80369180-7d90-4ee8-99a1-19fa68512aa5"' /subscriptions/{subscriptionId}/usage: get: @@ -2166,146 +1908,11 @@ paths: security: - OAuth2Security: - apk:subscribe - - apk:sub_manage x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/subscriptions/5b65808c-cdf2-43e1-a695-de63e3ad0ae9/usage"' + "https://api.am.wso2.com:9095/api/am/devportal/subscriptions/5b65808c-cdf2-43e1-a695-de63e3ad0ae9/usage"' - ###################################################### - # The "Throttling Policy Collection" resource APIs - ###################################################### - /throttling-policies/{policyLevel}: - get: - tags: - - Throttling Policies - summary: Get All Available Throttling Policies - description: | - This operation can be used to get all available application or subscription level throttling policies - parameters: - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' - - $ref: '#/components/parameters/policyLevel' - - $ref: '#/components/parameters/If-None-Match' - - $ref: '#/components/parameters/requestedTenant' - responses: - 200: - description: | - OK. List of throttling policies returned. - headers: - ETag: - description: | - Entity Tag of the response resource. Used by caches, or in conditional requests. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/ThrottlingPolicyList' - 304: - description: | - Not Modified. Empty body because the client has already the latest version of the requested resource. - content: {} - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: [] - x-code-samples: - - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/throttling-policies/application" - - ###################################################### - # The "Individual Throttling Policy" resource APIs - ###################################################### - /throttling-policies/{policyLevel}/{policyId}: - get: - tags: - - Throttling Policies - summary: | - Get Details of a Throttling Policy - description: | - This operation can be used to retrieve details of a single throttling policy by specifying the policy level and policy name. - parameters: - - $ref: '#/components/parameters/policyId' - - $ref: '#/components/parameters/policyLevel' - - $ref: '#/components/parameters/requestedTenant' - - $ref: '#/components/parameters/If-None-Match' - responses: - 200: - description: | - OK. Throttling Policy returned - headers: - ETag: - description: | - Entity Tag of the response resource. Used by caches, or in conditional requests. - schema: - type: string - Last-Modified: - description: | - Date and time the resource has been modified the last time. Used by caches, or in conditional requests. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/ThrottlingPolicy' - 304: - description: | - Not Modified. Empty body because the client has already the latest version of the requested resource. - content: {} - 404: - $ref: '#/components/responses/NotFound' - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: [] - x-code-samples: - - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/throttling-policies/application/10PerMin" - - ###################################################### - # The "Tag Collection" resource API - ###################################################### - /tags: - get: - tags: - - Tags - summary: | - Get All Tags - description: | - This operation can be used to retrieve a list of tags that are already added to APIs. - parameters: - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' - - $ref: '#/components/parameters/requestedTenant' - - $ref: '#/components/parameters/If-None-Match' - responses: - 200: - description: | - OK. Tag list is returned. - headers: - ETag: - description: | - Entity Tag of the response resource. Used by caches, or in conditional requests. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/TagList' - 304: - description: | - Not Modified. Empty body because the client has already the latest version of the requested resource. - content: {} - 404: - $ref: '#/components/responses/NotFound' - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: [] - x-code-samples: - - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/tags" ###################################################### # The "Content Search Results" resource APIs @@ -2357,7 +1964,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/search?query=PizzaShackAPI" + source: curl -k "https://api.am.wso2.com:9095/api/am/devportal/search?query=PizzaShackAPI" ###################################################### # The "SDK Generation Languages" list resource APIs @@ -2387,194 +1994,8 @@ paths: x-code-samples: - lang: Curl source: curl -k -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/sdk-gen/languages" - - ###################################################### - # The Web hook API topic details - ###################################################### - /webhooks/subscriptions: - get: - tags: - - Webhooks - summary: | - Get available web hook subscriptions for a given application. - description: | - This operation will provide a list of web hook topic subscriptions for a given application. If the api id is provided results will be filtered by the api Id. - parameters: - - $ref: '#/components/parameters/applicationId-Q' - - $ref: '#/components/parameters/apiId-Q' - - $ref: '#/components/parameters/requestedTenant' - responses: - 200: - description: | - OK. Topic list returned. - headers: - ETag: - description: | - Entity Tag of the response resource. Used by caches, or in conditional requests. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookSubscriptionList' - 404: - $ref: '#/components/responses/NotFound' - 500: - $ref: '#/components/responses/InternalServerError' - security: - - OAuth2Security: [] - x-code-samples: - - lang: Curl - source: curl -k -H "Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/webhooks/subscriptions?applicationId=5b65808c-cdf2-43e1-a695-de63e3ad0ae9&apiId=ae4eae22-3f65-387b-a171-d37eaa366fa8" - - ###################################################### - # The Developer Portal settings List - ###################################################### - /settings: - get: - tags: - - Settings - summary: Retrieve Developer Portal settings - description: | - Retreive Developer Portal settings - parameters: - - $ref: '#/components/parameters/requestedTenant' - responses: - 200: - description: | - OK. Settings returned - content: - application/json: - schema: - $ref: '#/components/schemas/Settings' - 404: - $ref: '#/components/responses/NotFound' - security: - - OAuth2Security: - - apk:store_settings - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/settings"' + "https://api.am.wso2.com:9095/api/am/devportal/sdk-gen/languages" - /settings/application-attributes: - get: - tags: - - Settings - summary: | - Get All Application Attributes from Configuration - description: | - This operation can be used to retrieve the application attributes from configuration. It will not return hidden attributes. - parameters: - - $ref: '#/components/parameters/If-None-Match' - responses: - 200: - description: | - OK. Application attributes returned. - headers: - Content-Type: - description: | - The content type of the body. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/ApplicationAttributeList' - 404: - $ref: '#/components/responses/NotFound' - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: - - apk:subscribe - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/settings/application-attributes"' - - ###################################################### - # The tenant resource APIs - ###################################################### - /tenants: - get: - tags: - - Tenants - summary: | - Get Tenants by State - description: | - This operation is used to get tenants by state - parameters: - - name: state - in: query - description: | - The state represents the current state of the tenant - schema: - type: string - default: active - enum: - - active - - inactive - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' - responses: - 200: - description: | - OK. Tenant names returned. - headers: - Content-Type: - description: | - The content type of the body. - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/TenantList' - 404: - $ref: '#/components/responses/NotFound' - 406: - $ref: '#/components/responses/NotAcceptable' - security: - - OAuth2Security: [] - x-code-samples: - - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/tenants" - - ###################################################### - # The "Recommendations" resource API - ###################################################### - /recommendations: - get: - tags: - - Recommendations - summary: Give API Recommendations for a User - description: This API can be used to get recommended APIs for a user who logs into the API Developer Portal - responses: - 200: - description: | - OK. Requested recommendations are returned - headers: - ETag: - description: | - Entity Tag of the response resource. Used by caches, or in conditional requests - schema: - type: string - content: - application/json: - schema: - $ref: '#/components/schemas/Recommendations' - 404: - $ref: '#/components/responses/NotFound' - security: - - OAuth2Security: - - apk:subscribe - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/recommendations"' ###################################################### # The "Category Collection" resource API @@ -2600,7 +2021,7 @@ paths: - OAuth2Security: [] x-code-samples: - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/api-categories" + source: curl -k "https://api.am.wso2.com:9095/api/am/devportal/api-categories" ###################################################### # The "Key Manager Collection" resource API @@ -2628,111 +2049,7 @@ paths: x-code-samples: - lang: Curl source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - "https://localhost:9443/api/devportal/key-managers"' - - ###################################################### - # GraphQL "Query Complexity" resource APIs - ###################################################### - /apis/{apiId}/graphql-policies/complexity: - get: - tags: - - GraphQL Policies - summary: Get the Complexity Related Details of an API - description: | - This operation can be used to retrieve complexity related details belonging to an API by providing the API id. - parameters: - - $ref: '#/components/parameters/apiId' - responses: - 200: - description: | - OK. Requested complexity details returned. - headers: - Content-Type: - description: | - The content of the body. - schema: - type: string - default: application/json - content: - application/json: - schema: - $ref: '#/components/schemas/GraphQLQueryComplexityInfo' - 404: - description: | - Not Found. Requested API does not contain any complexity details. - content: {} - security: - - OAuth2Security: [] - x-code-samples: - - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/graphql-policies/complexity" - - /apis/{apiId}/graphql-policies/complexity/types: - get: - tags: - - GraphQL Policies - summary: Retrieve Types and Fields of a GraphQL Schema - description: | - This operation can be used to retrieve all types and fields of the GraphQL Schema by providing the API id. - parameters: - - $ref: '#/components/parameters/apiId' - responses: - 200: - description: | - OK. Types and fields returned successfully. - headers: - Content-Type: - description: | - The content of the body. - schema: - type: string - default: application/json - content: - application/json: - schema: - $ref: '#/components/schemas/GraphQLSchemaTypeList' - 404: - description: | - Not Found. Retrieving types and fields failed. - content: {} - security: - - OAuth2Security: [] - x-code-samples: - - lang: Curl - source: curl -k "https://localhost:9443/api/devportal/apis/e93fb282-b456-48fc-8981-003fb89086ae/graphql-policies/complexity/types" - - ###################################################### - # User resource APIs - ###################################################### - /me/change-password: - post: - tags: - - Users - summary: Change the Password of the user - description: | - Using this operation, logged-in user can change their password. - operationId: changeUserPassword - requestBody: - description: | - Current and new password of the user - content: - application/json: - schema: - $ref: '#/components/schemas/CurrentAndNewPasswords' - required: true - responses: - 200: - description: OK. User password changed successfully - content: {} - 400: - $ref: '#/components/responses/BadRequest' - security: - - OAuth2Security: - - apk:subscribe - x-code-samples: - - lang: Curl - source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" - -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/devportal/me/change-password"' + "https://api.am.wso2.com:9095/api/am/devportal/key-managers"' components: schemas: diff --git a/devportal/devportal-domain-service/ballerina/types.bal b/devportal/devportal-domain-service/ballerina/types.bal index 026dc191f..5cf670c2a 100644 --- a/devportal/devportal-domain-service/ballerina/types.bal +++ b/devportal/devportal-domain-service/ballerina/types.bal @@ -1,23 +1,8 @@ -// -// Copyright (c) 2022, WSO2 LLC. (http://www.wso2.com). -// -// WSO2 LLC. licenses this file to you under the Apache License, -// Version 2.0 (the "License"); you may not use this file except -// in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// +// AUTO-GENERATED FILE. +// This file is auto-generated by the Ballerina OpenAPI tool. -import ballerina/http; import ballerina/constraint; +import ballerina/http; public type AcceptedWorkflowResponse record {| *http:Accepted; @@ -89,11 +74,6 @@ public type OkApplicationKeyReGenerateResponse record {| ApplicationKeyReGenerateResponse body; |}; -public type OkApplicationInfo record {| - *http:Ok; - ApplicationInfo body; -|}; - public type DocumentList record { # Number of Documents returned. int count?; @@ -117,9 +97,9 @@ public type ApplicationKey record { # Describes the state of the key generation. string keyState?; # Describes to which endpoint the key belongs - string keyType?; + "PRODUCTION"|"SANDBOX" keyType?; # Describe the which mode Application Mapped. - string mode?; + "MAPPED"|"CREATED" mode?; ApplicationToken token?; # additionalProperties (if any). record {} additionalProperties?; @@ -143,7 +123,7 @@ public type APIInfo_additionalProperties record { }; public type ApplicationKeyGenerateRequest record { - string keyType; + "PRODUCTION"|"SANDBOX" keyType; # key Manager to Generate Keys string keyManager?; # Grant types that should be supported by the application @@ -160,9 +140,9 @@ public type ApplicationKeyGenerateRequest record { public type Document record { string documentId?; string name; - string documentType; + "HOWTO"|"SAMPLES"|"PUBLIC_FORUM"|"SUPPORT_FORUM"|"API_MESSAGE_FORMAT"|"SWAGGER_DOC"|"OTHER" documentType?; string summary?; - string sourceType; + "INLINE"|"MARKDOWN"|"URL"|"FILE" sourceType; string sourceUrl?; string otherTypeName?; }; @@ -248,8 +228,7 @@ public type Subscription record { string apiId; APIInfo apiInfo?; ApplicationInfo applicationInfo?; - string status?; - string subscriptionCreateState?; + "BLOCKED"|"PROD_ONLY_BLOCKED"|"UNBLOCKED"|"ON_HOLD"|"REJECTED"|"TIER_UPDATE_PENDING"|"DELETE_PENDING" status?; # A url and other parameters the subscriber can be redirected. string redirectionParams?; }; @@ -276,7 +255,7 @@ public type Settings record { }; public type ThrottlingPolicyPermissionInfo record { - string 'type?; + "allow"|"deny" 'type?; # roles for this permission string[] roles?; }; @@ -348,7 +327,7 @@ public type ApplicationKeyList record { }; public type APIDefinition record { - string 'type; + "swagger"|"graphql"|"wsdl"|"async" 'type; string schemaDefinition?; }; @@ -358,18 +337,13 @@ public type CommenterInfo record { string fullName?; }; -public type Applications_import_body record { - # Zip archive consisting of exported Application Configuration. - record {byte[] fileContent; string fileName;} file; -}; - public type AdvertiseInfo record { boolean advertised?; string apiExternalProductionEndpoint?; string apiExternalSandboxEndpoint?; string originalDevPortalUrl?; string apiOwner?; - string vendor?; + "WSO2"|"AWS" vendor?; }; public type CommentList record { @@ -581,7 +555,7 @@ public type ApplicationKeyMappingRequest record { string consumerSecret?; # Key Manager Name string keyManager?; - string keyType; + "PRODUCTION"|"SANDBOX" keyType; }; public type Topic record { @@ -606,7 +580,7 @@ public type Comment record { string updatedTime?; string category = "general"; string parentCommentId?; - string entryPoint?; + "devPortal"|"publisher" entryPoint?; CommenterInfo commenterInfo?; CommentList replies?; }; @@ -618,7 +592,8 @@ public type ApplicationTokenGenerateRequest record { int validityPeriod?; # Token to be revoked, if any string revokeToken?; - string grantType?; + "CLIENT_CREDENTIALS"|"TOKEN_EXCHANGE" grantType?; + # Scopes to be assigned to the access token string[] scopes?; # Additional parameters if Authorization server needs any record {} additionalProperties?; @@ -647,7 +622,7 @@ public type KeyManagerInfo record { string alias?; record {} additionalProperties?; # The type of the tokens to be used (exchanged or without exchanged). Accepted values are EXCHANGED, DIRECT and BOTH. - string tokenType = "DIRECT"; + "EXCHANGED"|"DIRECT"|"BOTH" tokenType = "DIRECT"; }; public type WebhookSubscription record { @@ -699,7 +674,7 @@ public type Error record { public type APIKeyGenerateRequest record { # Token validity period - int validityPeriod?; + int:Signed32 validityPeriod?; # Additional parameters if Authorization server needs any record {} additionalProperties?; }; @@ -716,7 +691,7 @@ public type ScopeInfo record { public type SearchResult record { string id?; string name; - string 'type?; + "DOC"|"API" 'type?; # Accepted values are HTTP, WS, SOAPTOREST, GRAPHQL string transportType?; }; @@ -724,7 +699,7 @@ public type SearchResult record { public type ThrottlingPolicy record { string name; string description?; - string policyLevel?; + "application"|"subscription" policyLevel?; # Custom attributes added to the throttling policy record {|string...;|} attributes?; # Maximum number of requests which can be sent within a provided unit time @@ -738,9 +713,9 @@ public type ThrottlingPolicy record { # Burst control time unit string rateLimitTimeUnit?; # Default quota limit type - string quotaPolicyType?; + "REQUESTCOUNT"|"BANDWIDTHVOLUME" quotaPolicyType?; # This attribute declares whether this tier is available under commercial or free - string tierPlan; + "FREE"|"COMMERCIAL" tierPlan; # If this attribute is set to false, you are capable of sending requests # even if the request count exceeded within a unit time boolean stopOnQuotaReach; @@ -751,17 +726,17 @@ public type ThrottlingPolicy record { public type APIKey record { # API Key string apikey?; - int validityTime?; + int:Signed32 validityTime?; }; public type DocumentSearchResult record { *SearchResult; - string docType?; + "HOWTO"|"SAMPLES"|"PUBLIC_FORUM"|"SUPPORT_FORUM"|"API_MESSAGE_FORMAT"|"SWAGGER_DOC"|"OTHER" docType?; string summary?; - string sourceType?; + "INLINE"|"URL"|"FILE"|"MARKDOWN" sourceType?; string sourceUrl?; string otherTypeName?; - string visibility?; + "OWNER_ONLY"|"PRIVATE"|"API_LEVEL" visibility?; # The name of the associated API string apiName?; # The version of the associated API @@ -806,7 +781,7 @@ public type SubscriptionList record { public type WorkflowResponse record { # This attribute declares whether this workflow task is approved or rejected. - string workflowStatus; + "CREATED"|"APPROVED"|"REJECTED"|"REGISTERED" workflowStatus; # Attributes that returned after the workflow execution string jsonPayload?; }; @@ -883,7 +858,7 @@ public type Tag record { }; public type MonetizationInfo record { - string billingType?; + "fixedPrice"|"dynamicRate" billingType?; string billingCycle?; string fixedPrice?; string pricePerRequest?;