From 7b002b4ebfd64e7da683febe2da35763245be47c Mon Sep 17 00:00:00 2001 From: VenkatakrishnaHR Date: Wed, 27 Dec 2023 10:26:44 +0530 Subject: [PATCH 1/6] swagger_doc --- api_docs_openapi.yaml | 444 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 444 insertions(+) create mode 100644 api_docs_openapi.yaml diff --git a/api_docs_openapi.yaml b/api_docs_openapi.yaml new file mode 100644 index 0000000..e24c943 --- /dev/null +++ b/api_docs_openapi.yaml @@ -0,0 +1,444 @@ +openapi: 3.0.0 +info: + title: Case API V2 + description: All the APIs are related to Case Attributes. + termsOfService: "" + version: '2.0' + contact: + name: UniCourt Support + url: https://unicourt.com/contact-us + email: support@unicourt.com + license: + name: UniCourt + url: https://unicourt.com +servers: + - url: '${SERVER_URL}' + +paths: + /articleByDate/{articleCreatedDate}: + parameters: + - in: path + name: articleCreatedDate + schema: + type: string + format: date-time + minLength: 10 + maxLength: 10 + nullable: false + examples: + HTTP200-ValidDate: + summary: ValidArticleCreatedDate + value: "2022-09-04" + HTTP404-InvalidCreatedDate: + summary: InvalidCreatedDate + value: "2022 09 04" + HTTP404-NoResultsFoundForCreatedDate: + summary: NoResultsFoundForCreatedDate + value: "2025-09-04" + required: true + description: Retrieve the case with the specified caseId value. + get: + security: + - bearerAuth: [ ] + operationId: getArticleByDate + tags: + - Python web scrapping APIs + summary: Get all articles for given date. + description: Gives all the parsed articles from python blogs for a given date. + parameters: [] + responses: + '200': + content: + application/json: + examples: + ValidDate: + $ref: "#/components/examples/ArticleByDate" + schema: + $ref: '#/components/schemas/ArticleByDate' + description: The request is received. + '404': + content: + application/json: + examples: + InvalidCreatedDate: + $ref: '#/components/examples/InvalidCreatedDate' + NoResultsFoundForCreatedDate: + $ref: '#/components/examples/NoResultsFoundForCreatedDate' + schema: + $ref: "#/components/schemas/Exception" + description: Resource Not Found + +tags: + - name: Python web scrapping APIs + description: "Python web scrapping APIs" + +components: + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT # for documentation purposes only + + examples: + ArticleByDate: + value: + object: Exception + code: UN400 + message: INVALID_INPUT + details: Request has failed while querying from the court. Please check your request parameters and retry. + + InvalidCreatedDate: + value: + object: Exception + code: UN400 + message: INVALID_INPUT + details: Requested articleCreatedDate is invalid. + + NoResultsFoundForCreatedDate: + value: + object: Exception + code: UN400 + message: INVALID_INPUT + details: No articles found for requested articleCreatedDate. + + schemas: + ArticleByDate: + x-unicourt-container: false + type: object + properties: + object: + type: string + description: "Name of the object" + default: PACERPartySearchResults + minLength: 23 + maxLength: 23 + nullable: false + pacerContent: + $ref: '#/components/schemas/PACERPartySearchContent' + hasOnlyMetaInfo: + description: "This field determines if the UniCourt Content has only meta information. If the value is true and you require to get the latest updates of the case you will need to make a request to the updateCase API." + example: false + type: boolean + uniCourtContent: + $ref: 'https://gitlab.unicourt.net/researcher/apollo/a-src-srh-sdoc/-/raw/staging/a_src_srh_api_doc.yaml#/components/schemas/CaseSearchResult' + required: + - object + - pacerContent + - hasOnlyMetaInfo + - uniCourtContent + + PossibleNormAttorney: + x-unicourt-container: false + title: PossibleNormAttorney + type: object + nullable: true + properties: + object: + type: string + description: Name of the object + default: PossibleNormAttorney + minLength: 20 + maxLength: 20 + nullable: false + normAttorneyId: + type: string + minLength: 18 + maxLength: 18 + nullable: false + normAttorneyName: + type: string + maxLength: 500 + nullable: false + bestMatch: + type: boolean + default: false + confidenceScore: + type: number + format: float + scoreConstituents: + type: object + required: + - nameSimilarityScore + - otherPotentialNormAttorneys + - barId + - address + - email + - phone + - lawFirm + properties: + nameSimilarityScore: + type: number + format: float + otherPotentialNormAttorneys: + type: integer + barId: + type: string + maxLength: 250 + nullable: false + enum: + - Matched + - Mismatched + - Not_Provided_By_Data_Source + address: + type: string + maxLength: 250 + nullable: false + enum: + - Matched + - Mismatched + - Not_Provided_By_Data_Source + email: + type: string + maxLength: 250 + nullable: false + enum: + - Matched + - Mismatched + - Not_Provided_By_Data_Source + phone: + type: string + maxLength: 250 + nullable: false + enum: + - Matched + - Mismatched + - Not_Provided_By_Data_Source + lawFirm: + type: string + maxLength: 250 + nullable: false + enum: + - Matched + - Mismatched + - Not_Provided_By_Data_Source + normAttorneyAPI: + x-logical-reference: NormAttorneyAPI + maxLength: 255 + type: string + format: uri + nullable: false + associatedNormJudgesAPI: + x-logical-reference: AssociatedNormJudgesForNormAttorneyAPI + type: string + maxLength: 255 + format: uri + nullable: false + associatedNormLawFirmsAPI: + x-logical-reference: AssociatedNormLawFirmsForNormAttorneyAPI + type: string + maxLength: 255 + format: uri + nullable: false + associatedNormPartiesAPI: + x-logical-reference: AssociatedNormPartiesForNormAttorneyAPI + type: string + maxLength: 255 + format: uri + nullable: false + caseCountAnalyticsByNormAttorneyAPI: + x-logical-reference: CaseCountAnalyticsByNormAttorneyAPI + type: string + maxLength: 255 + format: uri + nullable: false + caseCountAnalyticsByOpposingNormAttorneyAPI: + x-logical-reference: CaseCountAnalyticsByOpposingNormAttorneyAPI + type: string + maxLength: 255 + format: uri + nullable: false + required: + - object + - normAttorneyId + - normAttorneyName + - bestMatch + - confidenceScore + - scoreConstituents + - normAttorneyAPI + - associatedNormJudgesAPI + - associatedNormLawFirmsAPI + - associatedNormPartiesAPI + - caseCountAnalyticsByNormAttorneyAPI + - caseCountAnalyticsByOpposingNormAttorneyAPI + PossibleNormLawFirm: + x-unicourt-container: false + title: PossibleNormLawFirm + type: object + nullable: true + properties: + object: + type: string + description: Name of the object + default: PossibleNormLawFirm + minLength: 19 + maxLength: 19 + nullable: false + normLawFirmId: + type: string + minLength: 18 + maxLength: 18 + nullable: false + normLawFirmName: + type: string + maxLength: 500 + nullable: false + bestMatch: + type: boolean + default: false + sourceDetails: + type: object + required: + - source + - linkedNormAttorneyIdArray + properties: + source: + type: string + maxLength: 250 + enum: + - Case_Attorney_Linked_In_Other_Cases + - Case_Attorney_Field_Contains_Law_Firm + nullable: true + linkedNormAttorneyIdArray: + type: array + items: + type: string + maxLength: 18 + minLength: 18 + nullable: false + confidenceScore: + type: number + format: float + scoreConstituents: + type: object + required: + - nameSimilarityScore + - otherPotentialNormLawFirms + - secretaryOfStateId + - address + - email + - phone + properties: + nameSimilarityScore: + type: number + format: float + otherPotentialNormLawFirms: + type: integer + secretaryOfStateId: + type: string + maxLength: 250 + nullable: false + enum: + - Matched + - Mismatched + - Not_Provided_By_Data_Source + address: + type: string + maxLength: 250 + nullable: false + enum: + - Matched + - Mismatched + - Not_Provided_By_Data_Source + email: + type: string + maxLength: 250 + nullable: false + enum: + - Matched + - Mismatched + - Not_Provided_By_Data_Source + phone: + type: string + maxLength: 250 + nullable: false + enum: + - Matched + - Mismatched + - Not_Provided_By_Data_Source + normLawFirmAPI: + x-logical-reference: NormLawFirmAPI + type: string + maxLength: 255 + format: uri + nullable: false + associatedNormAttorneyAPI: + x-logical-reference: AssociatedNormAttorneysForNormLawFirmAPI + type: string + maxLength: 255 + format: uri + nullable: false + associatedNormJudgeAPI: + x-logical-reference: AssociatedNormJudgesForNormLawFirmAPI + type: string + maxLength: 255 + format: uri + nullable: false + associatedNormPartiesAPI: + x-logical-reference: AssociatedNormPartiesForNormJudgeAPI + type: string + maxLength: 255 + format: uri + nullable: false + caseCountAnalyticsByNormLawFirmAPI: + x-logical-reference: CaseCountAnalyticsByNormLawFirmAPI + type: string + maxLength: 255 + format: uri + nullable: false + caseCountAnalyticsByOpposingNormLawFirmAPI: + x-logical-reference: CaseCountAnalyticsByOpposingNormLawFirmAPI + type: string + maxLength: 255 + format: uri + nullable: false + required: + - object + - normLawFirmId + - normLawFirmName + - bestMatch + - sourceDetails + - confidenceScore + - scoreConstituents + - normLawFirmAPI + - associatedNormAttorneyAPI + - associatedNormJudgeAPI + - associatedNormPartiesAPI + - caseCountAnalyticsByNormLawFirmAPI + - caseCountAnalyticsByOpposingNormLawFirmAPI + + Exception: + title: Exception + type: object + description: Exception object contains specific error code and its message related to the API request validation error or error occurred during API request processing. + nullable: True + properties: + object: + type: string + example: Exception + default: Exception + minLength: 9 + maxLength: 9 + nullable: False + code: + type: string + description: Indicates the type of error occurred. + minLength: 1 + maxLength: 75 + nullable: False + message: + type: string + description: Indicates the error message that describes the error code. + minLength: 1 + maxLength: 255 + nullable: False + details: + type: string + description: Describes what went wrong. + minLength: 1 + maxLength: 255 + nullable: False + required: + - object + - code + - message + - details From 1a0788d5fd64c51739a203792f32bfa3cb190a39 Mon Sep 17 00:00:00 2001 From: VenkatakrishnaHR Date: Wed, 27 Dec 2023 10:27:14 +0530 Subject: [PATCH 2/6] API docs --- api_docs_openapi.yaml | 365 ++++++++++-------------------------------- 1 file changed, 83 insertions(+), 282 deletions(-) diff --git a/api_docs_openapi.yaml b/api_docs_openapi.yaml index e24c943..d1bed5f 100644 --- a/api_docs_openapi.yaml +++ b/api_docs_openapi.yaml @@ -15,7 +15,7 @@ servers: - url: '${SERVER_URL}' paths: - /articleByDate/{articleCreatedDate}: + /articlesByDate/{articleCreatedDate}/: parameters: - in: path name: articleCreatedDate @@ -40,7 +40,7 @@ paths: get: security: - bearerAuth: [ ] - operationId: getArticleByDate + operationId: getArticlesByDate tags: - Python web scrapping APIs summary: Get all articles for given date. @@ -52,9 +52,9 @@ paths: application/json: examples: ValidDate: - $ref: "#/components/examples/ArticleByDate" + $ref: "#/components/examples/ArticlesByDate" schema: - $ref: '#/components/schemas/ArticleByDate' + $ref: '#/components/schemas/ArticlesByDate' description: The request is received. '404': content: @@ -80,12 +80,20 @@ components: bearerFormat: JWT # for documentation purposes only examples: - ArticleByDate: + ArticlesByDate: value: - object: Exception - code: UN400 - message: INVALID_INPUT - details: Request has failed while querying from the court. Please check your request parameters and retry. + object: ArticlesByDate + articleCreatedDate: 2022-09-04 + articlesByDateArray: + - object: Article + title: "Python 3.13.0 alpha 1 is now available" + releaseDate: 2022-09-04 + author: "Thomas Wouters" + blogTime: "8:31 AM" + createdDate: 2022-09-04 + nextPageAPI: null + totalPages: 1 + totalCount: 1 InvalidCreatedDate: value: @@ -102,309 +110,102 @@ components: details: No articles found for requested articleCreatedDate. schemas: - ArticleByDate: - x-unicourt-container: false - type: object - properties: - object: - type: string - description: "Name of the object" - default: PACERPartySearchResults - minLength: 23 - maxLength: 23 - nullable: false - pacerContent: - $ref: '#/components/schemas/PACERPartySearchContent' - hasOnlyMetaInfo: - description: "This field determines if the UniCourt Content has only meta information. If the value is true and you require to get the latest updates of the case you will need to make a request to the updateCase API." - example: false - type: boolean - uniCourtContent: - $ref: 'https://gitlab.unicourt.net/researcher/apollo/a-src-srh-sdoc/-/raw/staging/a_src_srh_api_doc.yaml#/components/schemas/CaseSearchResult' - required: - - object - - pacerContent - - hasOnlyMetaInfo - - uniCourtContent - - PossibleNormAttorney: + ArticlesByDate: x-unicourt-container: false - title: PossibleNormAttorney type: object - nullable: true properties: object: type: string - description: Name of the object - default: PossibleNormAttorney - minLength: 20 - maxLength: 20 - nullable: false - normAttorneyId: - type: string - minLength: 18 - maxLength: 18 - nullable: false - normAttorneyName: - type: string - maxLength: 500 - nullable: false - bestMatch: - type: boolean - default: false - confidenceScore: - type: number - format: float - scoreConstituents: - type: object - required: - - nameSimilarityScore - - otherPotentialNormAttorneys - - barId - - address - - email - - phone - - lawFirm - properties: - nameSimilarityScore: - type: number - format: float - otherPotentialNormAttorneys: - type: integer - barId: - type: string - maxLength: 250 - nullable: false - enum: - - Matched - - Mismatched - - Not_Provided_By_Data_Source - address: - type: string - maxLength: 250 - nullable: false - enum: - - Matched - - Mismatched - - Not_Provided_By_Data_Source - email: - type: string - maxLength: 250 - nullable: false - enum: - - Matched - - Mismatched - - Not_Provided_By_Data_Source - phone: - type: string - maxLength: 250 - nullable: false - enum: - - Matched - - Mismatched - - Not_Provided_By_Data_Source - lawFirm: - type: string - maxLength: 250 - nullable: false - enum: - - Matched - - Mismatched - - Not_Provided_By_Data_Source - normAttorneyAPI: - x-logical-reference: NormAttorneyAPI - maxLength: 255 - type: string - format: uri - nullable: false - associatedNormJudgesAPI: - x-logical-reference: AssociatedNormJudgesForNormAttorneyAPI - type: string - maxLength: 255 - format: uri - nullable: false - associatedNormLawFirmsAPI: - x-logical-reference: AssociatedNormLawFirmsForNormAttorneyAPI - type: string - maxLength: 255 - format: uri - nullable: false - associatedNormPartiesAPI: - x-logical-reference: AssociatedNormPartiesForNormAttorneyAPI - type: string - maxLength: 255 - format: uri + description: "Array of articles posted on given date" + default: ArticlesByDate + minLength: 14 + maxLength: 14 nullable: false - caseCountAnalyticsByNormAttorneyAPI: - x-logical-reference: CaseCountAnalyticsByNormAttorneyAPI + articleCreatedDate: type: string - maxLength: 255 - format: uri + format: date-time + minLength: 10 + maxLength: 10 + example: 2022-09-04 nullable: false - caseCountAnalyticsByOpposingNormAttorneyAPI: - x-logical-reference: CaseCountAnalyticsByOpposingNormAttorneyAPI + articlesByDateArray: + type: array + items: + $ref: '#/components/schemas/Article' + nextPageAPI: + description: Link to next page of the ArticlesByDate Results. + example: ${SERVER_URL}/articlesByDate/2022-02-01/?pageNumber=2 type: string maxLength: 255 - format: uri - nullable: false + nullable: true + totalPages: + description: Total number of pages to obtain all the objects of the ArticlesByDate Results. + example: 3 + type: integer + totalCount: + description: Total number of records available for this Search. + example: 125 + type: integer required: - - object - - normAttorneyId - - normAttorneyName - - bestMatch - - confidenceScore - - scoreConstituents - - normAttorneyAPI - - associatedNormJudgesAPI - - associatedNormLawFirmsAPI - - associatedNormPartiesAPI - - caseCountAnalyticsByNormAttorneyAPI - - caseCountAnalyticsByOpposingNormAttorneyAPI - PossibleNormLawFirm: + - object + - articleCreatedDate + - articlesByDateArray + - nextPageAPI + - totalPages + - totalCount + + Article: x-unicourt-container: false - title: PossibleNormLawFirm + title: Article type: object nullable: true properties: object: type: string description: Name of the object - default: PossibleNormLawFirm - minLength: 19 - maxLength: 19 - nullable: false - normLawFirmId: - type: string - minLength: 18 - maxLength: 18 - nullable: false - normLawFirmName: - type: string - maxLength: 500 - nullable: false - bestMatch: - type: boolean - default: false - sourceDetails: - type: object - required: - - source - - linkedNormAttorneyIdArray - properties: - source: - type: string - maxLength: 250 - enum: - - Case_Attorney_Linked_In_Other_Cases - - Case_Attorney_Field_Contains_Law_Firm - nullable: true - linkedNormAttorneyIdArray: - type: array - items: - type: string - maxLength: 18 - minLength: 18 - nullable: false - confidenceScore: - type: number - format: float - scoreConstituents: - type: object - required: - - nameSimilarityScore - - otherPotentialNormLawFirms - - secretaryOfStateId - - address - - email - - phone - properties: - nameSimilarityScore: - type: number - format: float - otherPotentialNormLawFirms: - type: integer - secretaryOfStateId: - type: string - maxLength: 250 - nullable: false - enum: - - Matched - - Mismatched - - Not_Provided_By_Data_Source - address: - type: string - maxLength: 250 - nullable: false - enum: - - Matched - - Mismatched - - Not_Provided_By_Data_Source - email: - type: string - maxLength: 250 - nullable: false - enum: - - Matched - - Mismatched - - Not_Provided_By_Data_Source - phone: - type: string - maxLength: 250 - nullable: false - enum: - - Matched - - Mismatched - - Not_Provided_By_Data_Source - normLawFirmAPI: - x-logical-reference: NormLawFirmAPI - type: string - maxLength: 255 - format: uri + default: Article + minLength: 7 + maxLength: 7 nullable: false - associatedNormAttorneyAPI: - x-logical-reference: AssociatedNormAttorneysForNormLawFirmAPI + title: type: string - maxLength: 255 - format: uri + minLength: 3 + maxLength: 200 nullable: false - associatedNormJudgeAPI: - x-logical-reference: AssociatedNormJudgesForNormLawFirmAPI + example: "Python 3.13.0 alpha 1 is now available" + releaseDate: type: string - maxLength: 255 - format: uri + format: date-time + minLength: 10 + maxLength: 10 + example: 2022-09-04 nullable: false - associatedNormPartiesAPI: - x-logical-reference: AssociatedNormPartiesForNormJudgeAPI + author: type: string - maxLength: 255 - format: uri + minLength: 3 + maxLength: 50 + example: "Thomas Wouters" nullable: false - caseCountAnalyticsByNormLawFirmAPI: - x-logical-reference: CaseCountAnalyticsByNormLawFirmAPI + blogTime: type: string - maxLength: 255 - format: uri - nullable: false - caseCountAnalyticsByOpposingNormLawFirmAPI: - x-logical-reference: CaseCountAnalyticsByOpposingNormLawFirmAPI + minLength: 7 + maxLength: 8 + example: "8:31 AM" + nullable: true + createdDate: type: string - maxLength: 255 - format: uri + format: date-time + minLength: 10 + maxLength: 10 + example: 2022-09-04 nullable: false required: - object - - normLawFirmId - - normLawFirmName - - bestMatch - - sourceDetails - - confidenceScore - - scoreConstituents - - normLawFirmAPI - - associatedNormAttorneyAPI - - associatedNormJudgeAPI - - associatedNormPartiesAPI - - caseCountAnalyticsByNormLawFirmAPI - - caseCountAnalyticsByOpposingNormLawFirmAPI + - title + - releaseDate + - author + - blogTime + - createdDate Exception: title: Exception From 8a2959e8f95ee9274c7e7ed89467c8dac7ef9b79 Mon Sep 17 00:00:00 2001 From: VenkatakrishnaHR Date: Wed, 27 Dec 2023 10:29:13 +0530 Subject: [PATCH 3/6] API docs --- api_docs_openapi.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/api_docs_openapi.yaml b/api_docs_openapi.yaml index d1bed5f..e8d4112 100644 --- a/api_docs_openapi.yaml +++ b/api_docs_openapi.yaml @@ -4,13 +4,6 @@ info: description: All the APIs are related to Case Attributes. termsOfService: "" version: '2.0' - contact: - name: UniCourt Support - url: https://unicourt.com/contact-us - email: support@unicourt.com - license: - name: UniCourt - url: https://unicourt.com servers: - url: '${SERVER_URL}' @@ -111,7 +104,6 @@ components: schemas: ArticlesByDate: - x-unicourt-container: false type: object properties: object: @@ -155,7 +147,6 @@ components: - totalCount Article: - x-unicourt-container: false title: Article type: object nullable: true From 011faf721df0fdf5b5789670336d10bea8d0929f Mon Sep 17 00:00:00 2001 From: VenkatakrishnaHR Date: Wed, 27 Dec 2023 10:52:37 +0530 Subject: [PATCH 4/6] API docs --- api_docs_openapi.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api_docs_openapi.yaml b/api_docs_openapi.yaml index e8d4112..2b122cb 100644 --- a/api_docs_openapi.yaml +++ b/api_docs_openapi.yaml @@ -49,12 +49,19 @@ paths: schema: $ref: '#/components/schemas/ArticlesByDate' description: The request is received. - '404': + '400': content: application/json: examples: InvalidCreatedDate: $ref: '#/components/examples/InvalidCreatedDate' + schema: + $ref: "#/components/schemas/Exception" + description: Resource Not Found + '404': + content: + application/json: + examples: NoResultsFoundForCreatedDate: $ref: '#/components/examples/NoResultsFoundForCreatedDate' schema: @@ -98,8 +105,8 @@ components: NoResultsFoundForCreatedDate: value: object: Exception - code: UN400 - message: INVALID_INPUT + code: UN404 + message: RESOURCE_NOT_FOUND details: No articles found for requested articleCreatedDate. schemas: From cb240696ea1368f8f2ff2c2ae6527e57362fe6cd Mon Sep 17 00:00:00 2001 From: VenkatakrishnaHR Date: Fri, 29 Dec 2023 22:52:13 +0530 Subject: [PATCH 5/6] doc_changes --- api_docs_openapi.yaml | 233 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 193 insertions(+), 40 deletions(-) diff --git a/api_docs_openapi.yaml b/api_docs_openapi.yaml index 2b122cb..d7ea07e 100644 --- a/api_docs_openapi.yaml +++ b/api_docs_openapi.yaml @@ -8,10 +8,10 @@ servers: - url: '${SERVER_URL}' paths: - /articlesByDate/{articleCreatedDate}/: + /articlesByReleaseDate/{articleReleaseDate}/: parameters: - in: path - name: articleCreatedDate + name: articleReleaseDate schema: type: string format: date-time @@ -20,24 +20,76 @@ paths: nullable: false examples: HTTP200-ValidDate: - summary: ValidArticleCreatedDate + summary: ValidArticleReleaseDate value: "2022-09-04" - HTTP404-InvalidCreatedDate: - summary: InvalidCreatedDate + HTTP404-InvalidReleaseDate: + summary: InvalidReleaseDate value: "2022 09 04" - HTTP404-NoResultsFoundForCreatedDate: - summary: NoResultsFoundForCreatedDate + HTTP404-NoResultsFoundForReleaseDate: + summary: NoResultsFoundForReleaseDate value: "2025-09-04" required: true - description: Retrieve the case with the specified caseId value. + description: Retrieve the articles released on specified releaseDate. get: security: - bearerAuth: [ ] - operationId: getArticlesByDate + operationId: getArticlesByReleaseDate tags: - Python web scrapping APIs summary: Get all articles for given date. description: Gives all the parsed articles from python blogs for a given date. + parameters: + - in: query + name: pageNumber + schema: + type: integer + examples: + HTTP200-ValidDate: + summary: ValidPageNumber + value: 1 + HTTP404-InvalidReleaseDate: + summary: InvalidPageNumber + value: 2.5 + HTTP404-NoResultsFoundForReleaseDate: + summary: PageNumberNotFound + value: 2000 + description: Query parameter specifying the page number of the search results to be retrieved. + responses: + '200': + content: + application/json: + examples: + ValidDate: + $ref: "#/components/examples/GetArticlesByReleaseDate" + schema: + $ref: '#/components/schemas/ArticlesByReleaseDate' + description: The request is received. + '400': + content: + application/json: + examples: + InvalidReleaseDate: + $ref: '#/components/examples/InvalidReleaseDate' + schema: + $ref: "#/components/schemas/Exception" + description: Invalid Release Date. + '404': + content: + application/json: + examples: + NoResultsFoundForReleaseDate: + $ref: '#/components/examples/NoResultsFoundForReleaseDate' + schema: + $ref: "#/components/schemas/Exception" + description: Resource Not Found. + post: + security: + - bearerAuth: [ ] + operationId: postArticlesByReleaseDate + tags: + - Python web scrapping APIs + summary: Extractor all articles for given date. + description: Extracts python blogs for a given date. parameters: [] responses: '200': @@ -45,28 +97,79 @@ paths: application/json: examples: ValidDate: - $ref: "#/components/examples/ArticlesByDate" + $ref: "#/components/examples/ArticleByReleaseDateRequest" schema: - $ref: '#/components/schemas/ArticlesByDate' + $ref: '#/components/schemas/ArticleByReleaseDateRequest' description: The request is received. '400': content: application/json: examples: - InvalidCreatedDate: - $ref: '#/components/examples/InvalidCreatedDate' + InvalidReleaseDate: + $ref: '#/components/examples/InvalidReleaseDate' schema: $ref: "#/components/schemas/Exception" - description: Resource Not Found + description: Invalid Release Date. + + /articleByReleaseDateRequest/{requestId}/: + parameters: + - in: path + name: requestId + schema: + type: string + minLength: 12 + maxLength: 12 + nullable: false + examples: + HTTP200-ValidDate: + summary: ValidArticleReleaseDate + value: "ARDR11223422" + HTTP404-InvalidReleaseDate: + summary: InvalidReleaseDate + value: "ARDR112234224455" + HTTP404-NoResultsFoundForReleaseDate: + summary: NoResultsFoundForReleaseDate + value: "ARDR00000000" + required: true + description: Get status of fetch article by release date request. + get: + security: + - bearerAuth: [ ] + operationId: getArticleByReleaseDateRequest + tags: + - Python web scrapping APIs + summary: Get status of fetch article by release date request. + description: Get status of fetch article by release date request. + parameters: [] + responses: + '200': + content: + application/json: + examples: + ValidDate: + $ref: "#/components/examples/ArticleByReleaseDateRequest" + schema: + $ref: '#/components/schemas/ArticleByReleaseDateRequest' + description: The request is received. + '400': + content: + application/json: + examples: + InvalidReleaseDate: + $ref: '#/components/examples/InvalidRequestId' + schema: + $ref: "#/components/schemas/Exception" + description: Invalid Release Date. '404': content: application/json: examples: - NoResultsFoundForCreatedDate: - $ref: '#/components/examples/NoResultsFoundForCreatedDate' + NoResultsFoundForReleaseDate: + $ref: '#/components/examples/NoResultsFoundForRequestId' schema: $ref: "#/components/schemas/Exception" - description: Resource Not Found + description: Resource Not Found. + tags: - name: Python web scrapping APIs @@ -80,65 +183,85 @@ components: bearerFormat: JWT # for documentation purposes only examples: - ArticlesByDate: + ArticleByReleaseDateRequest: value: - object: ArticlesByDate - articleCreatedDate: 2022-09-04 - articlesByDateArray: + object: ArticleByReleaseDateRequest + requestId: ARDR11223422 + status: "IN PROGRESS" + + GetArticlesByReleaseDate: + value: + object: ArticlesByReleaseDate + articleReleaseDate: 2022-09-04 + articlesByReleaseDateArray: - object: Article title: "Python 3.13.0 alpha 1 is now available" releaseDate: 2022-09-04 author: "Thomas Wouters" blogTime: "8:31 AM" - createdDate: 2022-09-04 + ReleaseDate: 2022-09-04 nextPageAPI: null totalPages: 1 totalCount: 1 - InvalidCreatedDate: + InvalidReleaseDate: value: object: Exception code: UN400 message: INVALID_INPUT - details: Requested articleCreatedDate is invalid. + details: Requested articleReleaseDate is invalid. - NoResultsFoundForCreatedDate: + NoResultsFoundForReleaseDate: value: object: Exception code: UN404 message: RESOURCE_NOT_FOUND - details: No articles found for requested articleCreatedDate. + details: No articles found for requested articleReleaseDate. + + InvalidRequestId: + value: + object: Exception + code: UN400 + message: INVALID_INPUT + details: Requested requestId is invalid. + + NoResultsFoundForRequestId: + value: + object: Exception + code: UN404 + message: RESOURCE_NOT_FOUND + details: No request found for requested requestId. schemas: - ArticlesByDate: + ArticlesByReleaseDate: type: object properties: object: type: string description: "Array of articles posted on given date" - default: ArticlesByDate + default: ArticlesByReleaseDate minLength: 14 maxLength: 14 nullable: false - articleCreatedDate: + articleReleaseDate: type: string format: date-time minLength: 10 maxLength: 10 example: 2022-09-04 nullable: false - articlesByDateArray: + articlesByReleaseDateArray: type: array items: $ref: '#/components/schemas/Article' nextPageAPI: - description: Link to next page of the ArticlesByDate Results. - example: ${SERVER_URL}/articlesByDate/2022-02-01/?pageNumber=2 + description: Link to next page of the ArticlesByReleaseDate Results. + example: ${SERVER_URL}/articlesByReleaseDate/2022-02-01/?pageNumber=2 type: string maxLength: 255 nullable: true totalPages: - description: Total number of pages to obtain all the objects of the ArticlesByDate Results. + description: Total number of pages to obtain all the objects of the ArticlesByReleaseDate Results. example: 3 type: integer totalCount: @@ -147,8 +270,8 @@ components: type: integer required: - object - - articleCreatedDate - - articlesByDateArray + - articleReleaseDate + - articlesByReleaseDateArray - nextPageAPI - totalPages - totalCount @@ -209,7 +332,7 @@ components: title: Exception type: object description: Exception object contains specific error code and its message related to the API request validation error or error occurred during API request processing. - nullable: True + nullable: true properties: object: type: string @@ -217,27 +340,57 @@ components: default: Exception minLength: 9 maxLength: 9 - nullable: False + nullable: false code: type: string description: Indicates the type of error occurred. minLength: 1 maxLength: 75 - nullable: False + nullable: false message: type: string description: Indicates the error message that describes the error code. minLength: 1 maxLength: 255 - nullable: False + nullable: false details: type: string description: Describes what went wrong. minLength: 1 maxLength: 255 - nullable: False + nullable: false required: - object - code - message - details + + ArticleByReleaseDateRequest: + title: Article By Release Date Request + type: object + description: Extraction request was received. + nullable: false + properties: + object: + type: string + default: ArticleByReleaseDateRequest + minLength: 27 + maxLength: 27 + nullable: false + requestId: + type: string + description: Unique Request ID + minLength: 13 + maxLength: 12 + example: ARDR11223422 + nullable: false + status: + type: string + enum: [ 'IN PROGRESS', 'COMPLETED', "FAILED" ] + description: Current status of request. + example: 'IN PROGRESS' + nullable: false + required: + - object + - requestId + - status From cefc7c7fecfb2d7752a53230e6e815e6a844c92a Mon Sep 17 00:00:00 2001 From: VenkatakrishnaHR Date: Wed, 3 Jan 2024 18:56:57 +0530 Subject: [PATCH 6/6] swagger_doc --- api_docs_openapi.yaml | 88 ++++++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 23 deletions(-) diff --git a/api_docs_openapi.yaml b/api_docs_openapi.yaml index d7ea07e..2199316 100644 --- a/api_docs_openapi.yaml +++ b/api_docs_openapi.yaml @@ -82,6 +82,8 @@ paths: schema: $ref: "#/components/schemas/Exception" description: Resource Not Found. + + /extractArticlesByReleaseDate/: post: security: - bearerAuth: [ ] @@ -90,7 +92,47 @@ paths: - Python web scrapping APIs summary: Extractor all articles for given date. description: Extracts python blogs for a given date. - parameters: [] + parameters: + - in: query + name: articleReleaseStartDate + schema: + type: string + format: date-time + minLength: 10 + maxLength: 10 + nullable: false + examples: + HTTP200-ValidDate: + summary: ValidArticleReleaseDate + value: "2022-09-04" + HTTP404-InvalidReleaseDate: + summary: InvalidReleaseDate + value: "2022 09 04" + HTTP404-NoResultsFoundForReleaseDate: + summary: NoResultsFoundForReleaseDate + value: "2025-09-04" + required: true + description: Retrieve the articles released from specified releaseDate. + - in: query + name: articleReleaseEndDate + schema: + type: string + format: date-time + minLength: 10 + maxLength: 10 + nullable: false + examples: + HTTP200-ValidDate: + summary: ValidArticleReleaseDate + value: "2022-09-04" + HTTP404-InvalidReleaseDate: + summary: InvalidReleaseDate + value: "2022 09 04" + HTTP404-NoResultsFoundForReleaseDate: + summary: NoResultsFoundForReleaseDate + value: "2025-09-04" + required: true + description: Retrieve the articles released till specified releaseDate. responses: '200': content: @@ -99,7 +141,7 @@ paths: ValidDate: $ref: "#/components/examples/ArticleByReleaseDateRequest" schema: - $ref: '#/components/schemas/ArticleByReleaseDateRequest' + $ref: '#/components/schemas/ExtractArticleByReleaseDateRequest' description: The request is received. '400': content: @@ -111,10 +153,10 @@ paths: $ref: "#/components/schemas/Exception" description: Invalid Release Date. - /articleByReleaseDateRequest/{requestId}/: + /extractArticlesByReleaseDate/{extractionRequestId}/: parameters: - in: path - name: requestId + name: extractionRequestId schema: type: string minLength: 12 @@ -147,16 +189,16 @@ paths: application/json: examples: ValidDate: - $ref: "#/components/examples/ArticleByReleaseDateRequest" + $ref: "#/components/examples/ExtractArticleByReleaseDateRequest" schema: - $ref: '#/components/schemas/ArticleByReleaseDateRequest' + $ref: '#/components/schemas/ExtractArticleByReleaseDateRequest' description: The request is received. '400': content: application/json: examples: InvalidReleaseDate: - $ref: '#/components/examples/InvalidRequestId' + $ref: '#/components/examples/InvalidExtractionRequestId' schema: $ref: "#/components/schemas/Exception" description: Invalid Release Date. @@ -165,7 +207,7 @@ paths: application/json: examples: NoResultsFoundForReleaseDate: - $ref: '#/components/examples/NoResultsFoundForRequestId' + $ref: '#/components/examples/NoResultsFoundForExtractionRequestId' schema: $ref: "#/components/schemas/Exception" description: Resource Not Found. @@ -183,10 +225,10 @@ components: bearerFormat: JWT # for documentation purposes only examples: - ArticleByReleaseDateRequest: + ExtractArticleByReleaseDateRequest: value: - object: ArticleByReleaseDateRequest - requestId: ARDR11223422 + object: ExtractArticleByReleaseDateRequest + extractionRequestId: ARDR11223422 status: "IN PROGRESS" GetArticlesByReleaseDate: @@ -197,7 +239,7 @@ components: - object: Article title: "Python 3.13.0 alpha 1 is now available" releaseDate: 2022-09-04 - author: "Thomas Wouters" + author: "Thomas Wouter" blogTime: "8:31 AM" ReleaseDate: 2022-09-04 nextPageAPI: null @@ -218,19 +260,19 @@ components: message: RESOURCE_NOT_FOUND details: No articles found for requested articleReleaseDate. - InvalidRequestId: + InvalidExtractionRequestId: value: object: Exception code: UN400 message: INVALID_INPUT - details: Requested requestId is invalid. + details: Requested extractionRequestId is invalid. - NoResultsFoundForRequestId: + NoResultsFoundForExtractionRequestId: value: object: Exception code: UN404 message: RESOURCE_NOT_FOUND - details: No request found for requested requestId. + details: No request found for requested extractionRequestId. schemas: ArticlesByReleaseDate: @@ -305,7 +347,7 @@ components: type: string minLength: 3 maxLength: 50 - example: "Thomas Wouters" + example: "Thomas Wouter" nullable: false blogTime: type: string @@ -365,7 +407,7 @@ components: - message - details - ArticleByReleaseDateRequest: + ExtractArticleByReleaseDateRequest: title: Article By Release Date Request type: object description: Extraction request was received. @@ -373,11 +415,11 @@ components: properties: object: type: string - default: ArticleByReleaseDateRequest - minLength: 27 - maxLength: 27 + default: ExtractArticleByReleaseDateRequest + minLength: 34 + maxLength: 34 nullable: false - requestId: + extractionRequestId: type: string description: Unique Request ID minLength: 13 @@ -392,5 +434,5 @@ components: nullable: false required: - object - - requestId + - extractionRequestId - status