Skip to content

Commit dcba3fd

Browse files
authored
Merge pull request #95 from messagemedia/feature-CMX-4541-report-download-api
CMX-4541: add report history and download URL endpoints
2 parents 771db81 + 9c22ae1 commit dcba3fd

1 file changed

Lines changed: 238 additions & 0 deletions

File tree

spec/openapi.yaml

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,136 @@ paths:
908908
application/json:
909909
schema:
910910
$ref: '#/components/schemas/fieldsresponse'
911+
/v2-preview/reporting/messages/async/reports:
912+
get:
913+
security:
914+
- basic_auth: [ ]
915+
- hmac_auth: [ ]
916+
- bearer_auth: [ ]
917+
tags:
918+
- Messaging Reports
919+
summary: Get async report history
920+
description: Returns a list of asynchronous reports that have been requested by the current account.
921+
operationId: GetAsyncReportHistory
922+
parameters:
923+
- name: page_size
924+
in: query
925+
description: The number of items to return per page.
926+
required: false
927+
style: form
928+
explode: true
929+
schema:
930+
type: integer
931+
example: 10
932+
- name: page_token
933+
in: query
934+
description: A pagination token returned from a previous call. Pass this to retrieve the next page of results.
935+
required: false
936+
style: form
937+
explode: true
938+
schema:
939+
type: string
940+
example: eyJyZXBvcnRJZCI6IjUxZjAwOTdmLTkwYjItNGE1OS1hZDg4LWEwZmQ5M2FiYWE4MiJ9
941+
- name: report_name
942+
in: query
943+
description: Filter results by report name.
944+
required: false
945+
style: form
946+
explode: true
947+
schema:
948+
type: string
949+
example: My Detail Report
950+
- name: status
951+
in: query
952+
description: Filter results by report status. Multiple statuses can be specified.
953+
required: false
954+
style: form
955+
explode: true
956+
schema:
957+
type: array
958+
items:
959+
type: string
960+
enum:
961+
- REQUESTED
962+
- RUNNING
963+
- FAILED
964+
- CANCELLED
965+
- DONE
966+
- name: start_date
967+
in: query
968+
description: Filter reports requested on or after this date (ISO 8601).
969+
required: false
970+
style: form
971+
explode: true
972+
schema:
973+
type: string
974+
format: date-time
975+
example: 2020-05-28T10:27:46.259Z
976+
- name: end_date
977+
in: query
978+
description: Filter reports requested on or before this date (ISO 8601).
979+
required: false
980+
style: form
981+
explode: true
982+
schema:
983+
type: string
984+
format: date-time
985+
example: 2020-06-28T10:27:46.259Z
986+
- name: sort_direction
987+
in: query
988+
description: Sort direction for the results.
989+
required: false
990+
style: form
991+
explode: true
992+
schema:
993+
type: string
994+
enum:
995+
- ASCENDING
996+
- DESCENDING
997+
example: DESCENDING
998+
responses:
999+
200:
1000+
description: A list of async reports for the current account.
1001+
headers: { }
1002+
content:
1003+
application/json:
1004+
schema:
1005+
$ref: '#/components/schemas/reporthistoryresponses'
1006+
deprecated: false
1007+
/v2-preview/reporting/messages/async/reports/{reportId}/download-url:
1008+
get:
1009+
security:
1010+
- basic_auth: [ ]
1011+
- hmac_auth: [ ]
1012+
- bearer_auth: [ ]
1013+
tags:
1014+
- Messaging Reports
1015+
summary: Get async report download URL
1016+
description: >-
1017+
Returns a temporary pre-signed URL for downloading the generated report.
1018+
The URL allows customers to securely download the report file directly using the provided reportId.
1019+
operationId: GetAsyncReportDownloadUrl
1020+
parameters:
1021+
- name: reportId
1022+
in: path
1023+
description: The ID of the report to download.
1024+
required: true
1025+
style: simple
1026+
schema:
1027+
type: string
1028+
format: uuid
1029+
example: 51f0097f-90b2-4a59-ad88-a0fd93abaa82
1030+
responses:
1031+
200:
1032+
description: A pre-signed URL for downloading the report.
1033+
headers: { }
1034+
content:
1035+
application/json:
1036+
schema:
1037+
$ref: '#/components/schemas/presignedurlresponse'
1038+
404:
1039+
description: Report not found.
1040+
deprecated: false
9111041
/v2-preview/reporting/detail/scheduled:
9121042
post:
9131043
security:
@@ -6580,6 +6710,110 @@ components:
65806710
type: string
65816711
example: [ id, content, meta1 ]
65826712
description: An array of fields to be retrieved.
6713+
reporthistoryresponses:
6714+
title: reporthistoryresponses
6715+
type: object
6716+
properties:
6717+
items:
6718+
type: array
6719+
items:
6720+
$ref: '#/components/schemas/reporthistoryresponse'
6721+
description: A list of report history items.
6722+
next_page_token:
6723+
type: string
6724+
description: A token to retrieve the next page of results. Absent if there are no more pages.
6725+
example: eyJyZXBvcnRJZCI6IjUxZjAwOTdmLTkwYjItNGE1OS1hZDg4LWEwZmQ5M2FiYWE4MiJ9
6726+
reporthistoryresponse:
6727+
title: reporthistoryresponse
6728+
type: object
6729+
properties:
6730+
report_id:
6731+
type: string
6732+
format: uuid
6733+
description: Unique identifier for the report.
6734+
example: 51f0097f-90b2-4a59-ad88-a0fd93abaa82
6735+
report_name:
6736+
type: string
6737+
description: The name of the report.
6738+
example: My Detail Report
6739+
report_type:
6740+
type: string
6741+
description: The type of the report.
6742+
enum:
6743+
- DETAIL
6744+
- SUMMARY
6745+
example: DETAIL
6746+
direction:
6747+
type: string
6748+
description: The message direction the report covers.
6749+
enum:
6750+
- INBOUND
6751+
- OUTBOUND
6752+
- ALL
6753+
example: OUTBOUND
6754+
requested_by:
6755+
type: string
6756+
description: The UUID of the user who requested the report.
6757+
example: MyAccount
6758+
requested_at:
6759+
type: string
6760+
format: date-time
6761+
description: The date and time when the report was requested (ISO 8601).
6762+
example: 2020-06-01T10:00:00.000Z
6763+
updated_at:
6764+
type: string
6765+
format: date-time
6766+
description: The date and time when the report was last updated (ISO 8601).
6767+
example: 2020-06-01T10:05:00.000Z
6768+
status:
6769+
type: string
6770+
description: The current status of the report.
6771+
enum:
6772+
- REQUESTED
6773+
- RUNNING
6774+
- FAILED
6775+
- CANCELLED
6776+
- DONE
6777+
example: DONE
6778+
account_id:
6779+
type: string
6780+
description: The account ID associated with the report.
6781+
example: MyAccount
6782+
vendor_id:
6783+
type: string
6784+
description: The vendor ID associated with the report.
6785+
example: messagemedia
6786+
s3_file_size:
6787+
type: integer
6788+
format: int64
6789+
description: The size of the report file in bytes.
6790+
example: 204800
6791+
presignedurlresponse:
6792+
title: presignedurlresponse
6793+
type: object
6794+
properties:
6795+
download_url:
6796+
type: string
6797+
description: The pre-signed URL for downloading the report file.
6798+
example: https://s3.amazonaws.com/reports/51f0097f.csv?AWSAccessKeyId=EXAMPLE
6799+
file_name:
6800+
type: string
6801+
description: The filename of the report CSV.
6802+
example: report-51f0097f-90b2-4a59-ad88-a0fd93abaa82.csv
6803+
file_size:
6804+
type: integer
6805+
format: int64
6806+
description: The size of the report file in bytes.
6807+
example: 204800
6808+
expires_in_seconds:
6809+
type: integer
6810+
description: The number of seconds until the pre-signed URL expires.
6811+
example: 3600
6812+
expires_at:
6813+
type: integer
6814+
format: int64
6815+
description: Unix timestamp (seconds) when the pre-signed URL expires.
6816+
example: 1622555046
65836817
detailresponse:
65846818
title: detailresponse
65856819
type: object
@@ -10527,3 +10761,7 @@ components:
1052710761
# The following options are specific to apiKey type
1052810762
in: header # Where API key will be passed: header or query
1052910763
name: Authorization # API key parameter name
10764+
bearer_auth:
10765+
type: http
10766+
scheme: bearer
10767+
bearerFormat: JWT

0 commit comments

Comments
 (0)