diff --git a/.gitignore b/.gitignore index 0eabd95..b8ae6b6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build .env node_modules .secrets +.vscode diff --git a/management/ad.yaml b/management/ad.yaml index 5bed5e8..a75953b 100644 --- a/management/ad.yaml +++ b/management/ad.yaml @@ -29,124 +29,7 @@ paths: content: application/json: schema: - type: object - required: - - Creative - - FlightId - - IsActive - properties: - Creative: - type: object - properties: - Id: - type: integer - format: int32 - FlightId: - type: integer - format: int32 - IsActive: - type: boolean - RtbCustomFields: - type: string - nullable: true - ActiveKeywords: - nullable: true - type: array - items: - type: string - CustomTargeting: - type: string - nullable: true - DistributionType: - type: integer - format: int32 - enum: [1, 2, 3] - nullable: true - Percentage: - type: integer - format: int32 - nullable: true - Impressions: - type: integer - format: int32 - nullable: true - SiteId: - type: integer - format: int32 - nullable: true - ZoneId: - type: integer - format: int32 - nullable: true - IsDeleted: - type: boolean - nullable: true - Iframe: - type: boolean - nullable: true - SizeOverride: - type: boolean - nullable: true - IsStartEndDateOverride: - type: boolean - nullable: true - StartDateIso: - type: string - format: date - nullable: true - EndDateIso: - type: string - format: date - nullable: true - IsGoalOverride: - type: boolean - nullable: true - GoalType: - type: integer - format: int32 - nullable: true - enum: [1, 2, 3, 7, 8, 9, 10] - Goal: - type: integer - format: int32 - nullable: true - IsNetworkAd: - type: boolean - nullable: true - IsNoTrack: - type: boolean - nullable: true - DontAffectParentFreqCap: - type: boolean - nullable: true - FreqCap: - type: integer - format: int32 - nullable: true - FreqCapDuration: - type: integer - format: int32 - nullable: true - FreqCapType: - type: integer - format: int32 - nullable: true - enum: [1, 2, 3] - Price: - type: number - format: float - nullable: true - ExternalMetadata: - type: string - nullable: true - CustomRelevancyScore: - type: integer - format: int32 - nullable: true - ProductId: - type: integer - format: int32 - nullable: true + $ref: './schemas/ad.yaml#/schemas/AdInput' responses: 200: description: The newly created Ad diff --git a/management/asset.yaml b/management/asset.yaml new file mode 100644 index 0000000..c265f6e --- /dev/null +++ b/management/asset.yaml @@ -0,0 +1,192 @@ +openapi: 3.0.1 +info: + title: Adzerk Management API - Entity Counts + description: Entity Counts related Adzerk Management API + version: '1.0' +servers: + - url: 'https://api.adzerk.net' +tags: + - name: entity-counts + description: Entity Counts +paths: + /v1/asset: + get: + tags: + - assets + description: list Assets + operationId: listAssets + security: + - ApiKeyAuth: [] + parameters: + - name: pageSize + in: query + description: The size of the page to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + - name: page + in: query + description: The page number to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + responses: + 200: + description: Paged list of Assets + content: + application/json: + schema: + $ref: './schemas/asset.yaml#/schemas/AssetList' + '/v1/asset/{assetId}': + parameters: + - name: assetId + in: path + description: Id of the Asset + required: true + schema: + type: integer + format: int32 + get: + tags: + - assets + description: Get an existing Asset + operationId: getAsset + security: + - ApiKeyAuth: [] + responses: + 200: + description: The existing Asset + content: + application/json: + schema: + $ref: './schemas/asset.yaml#/schemas/AssetDetails' + '/v1/advertiser/{advertiserId}/asset': + parameters: + - name: advertiserId + in: path + description: Id of the Advertiser + required: true + schema: + type: integer + format: int32 + get: + tags: + - assets + description: List Assets for Advertiser + operationId: listAdvertiserAssets + security: + - ApiKeyAuth: [] + parameters: + - name: pageSize + in: query + description: The size of the page to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + - name: page + in: query + description: The page number to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + responses: + 200: + description: Paged list of Assets for Advertiser + content: + application/json: + schema: + $ref: './schemas/asset.yaml#/schemas/AssetList' + post: + tags: + - assets + description: Create Asset + operationId: createAsset + security: + - ApiKeyAuth: [] + requestBody: + content: + application/json: + schema: + $ref: './schemas/asset.yaml#/schemas/AssetInput' + responses: + 200: + description: Asset Created + content: + application/json: + schema: + $ref: './schemas/asset.yaml#/schemas/Asset' + '/v1/asset/{assetId}/delete': + parameters: + - name: assetId + in: path + description: Id of the Asset + required: true + schema: + type: integer + format: int32 + post: + tags: + - assets + description: Delete an existing Asset + operationId: deleteAsset + security: + - ApiKeyAuth: [] + responses: + 200: + description: Successfully Deleted + '/v1/asset/{assetId}/upload': + parameters: + - name: assetId + in: path + description: Id of the Asset + required: true + schema: + type: integer + format: int32 + post: + tags: + - assets + description: Upload content to an existing Asset + operationId: uploadAssetContent + security: + - ApiKeyAuth: [] + parameters: + - name: timestamp + in: query + description: Milliseconds since epoch from asset creation + required: true + schema: + type: integer + format: int32 + - name: signature + in: query + description: Signing hash from asset creation + required: true + schema: + type: string + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: This must be an image file + responses: + 200: + description: Successfully Uploaded + +components: + securitySchemes: + $ref: './components/security-schemes.yaml#/components/securitySchemes' diff --git a/management/campaign.yaml b/management/campaign.yaml index 4fda3e1..52949d8 100644 --- a/management/campaign.yaml +++ b/management/campaign.yaml @@ -41,7 +41,7 @@ paths: content: application/json: schema: - $ref: './schemas/campaign.yaml#/schemas/Campaign' + $ref: './schemas/campaign.yaml#/schemas/CampaignInput' responses: 200: description: Campaign Created diff --git a/management/job.yaml b/management/job.yaml new file mode 100644 index 0000000..1bc1163 --- /dev/null +++ b/management/job.yaml @@ -0,0 +1,100 @@ +openapi: 3.0.1 +info: + title: Adzerk Management API - Advertisers + description: Advertiser related Adzerk Management API + version: '1.0' +servers: + - url: 'https://api.adzerk.net' +tags: + - name: jobs + description: Create Jobs +paths: + /v1/job/{jobId}: + get: + tags: + - jobs + description: Get Job + operationId: getJob + security: + - ApiKeyAuth: [] + parameters: + - name: jobId + in: path + description: The Job Id + required: true + schema: + type: integer + format: int32 + - name: verbose + in: query + description: Whether to return TaskArgs and Output attributes in returned jobs + required: false + schema: + type: boolean + responses: + 200: + description: The specified Job + content: + application/json: + schema: + $ref: './schemas/job.yaml#/schemas/Job' + /v1/job: + get: + tags: + - jobs + description: List Jobs + operationId: listJobs + security: + - ApiKeyAuth: [] + parameters: + - name: verbose + in: query + description: Whether to return TaskArgs and Output attributes in returned jobs + required: false + schema: + type: boolean + - name: pageSize + in: query + description: The size of the page to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + - name: page + in: query + description: The page number to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + responses: + 200: + description: A paged list of Jobs + content: + application/json: + schema: + $ref: './schemas/job.yaml#/schemas/JobList' + post: + tags: + - jobs + description: Create Jobs + operationId: createJob + security: + - ApiKeyAuth: [] + requestBody: + content: + application/json: + schema: + $ref: './schemas/job.yaml#/schemas/JobInput' + responses: + 200: + description: Job Created + content: + application/json: + schema: + $ref: './schemas/job.yaml#/schemas/Job' +components: + securitySchemes: + $ref: './components/security-schemes.yaml#/components/securitySchemes' diff --git a/management/openapi-3.yaml b/management/openapi-3.yaml index 91165a7..116d306 100644 --- a/management/openapi-3.yaml +++ b/management/openapi-3.yaml @@ -36,6 +36,10 @@ tags: description: Ad Types - name: priorities description: Priorities + - name: jobs + description: Create Jobs + - name: assets + description: Manage Assets paths: /v1/advertiser: post: @@ -203,7 +207,7 @@ paths: content: application/json: schema: - $ref: './schemas/campaign.yaml#/schemas/Campaign' + $ref: './schemas/campaign.yaml#/schemas/CampaignInput' responses: 200: description: Campaign Created @@ -663,7 +667,7 @@ paths: content: application/json: schema: - type: object + $ref: './schemas/ad.yaml#/schemas/AdInput' responses: 200: description: The newly created Ad @@ -1037,7 +1041,7 @@ paths: format: int32 responses: 200: - description: "Successfully Deleted" + description: 'Successfully Deleted' '/v1/flight/{flightId}/sitezonetargeting': post: tags: @@ -2034,13 +2038,273 @@ paths: responses: 200: description: Successfully Deleted + /v1/job/{jobId}: + get: + tags: + - jobs + description: Get Job + operationId: getJob + security: + - ApiKeyAuth: [] + parameters: + - name: jobId + in: path + description: The Job Id + required: true + schema: + type: integer + format: int32 + - name: verbose + in: query + description: Whether to return TaskArgs and Output attributes in returned jobs + required: false + schema: + type: boolean + responses: + 200: + description: The specified Job + content: + application/json: + schema: + $ref: './schemas/job.yaml#/schemas/Job' + /v1/job: + get: + tags: + - jobs + description: List Jobs + operationId: listJobs + security: + - ApiKeyAuth: [] + parameters: + - name: verbose + in: query + description: Whether to return TaskArgs and Output attributes in returned jobs + required: false + schema: + type: boolean + - name: pageSize + in: query + description: The size of the page to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + - name: page + in: query + description: The page number to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + responses: + 200: + description: A paged list of Jobs + content: + application/json: + schema: + $ref: './schemas/job.yaml#/schemas/JobList' + post: + tags: + - jobs + description: Create Jobs + operationId: createJob + security: + - ApiKeyAuth: [] + requestBody: + content: + application/json: + schema: + $ref: './schemas/job.yaml#/schemas/JobInput' + responses: + 200: + description: Job Created + content: + application/json: + schema: + $ref: './schemas/job.yaml#/schemas/Job' + /v1/asset: + get: + tags: + - assets + description: list Assets + operationId: listAssets + security: + - ApiKeyAuth: [] + parameters: + - name: pageSize + in: query + description: The size of the page to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + - name: page + in: query + description: The page number to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + responses: + 200: + description: Paged list of Assets + content: + application/json: + schema: + $ref: './schemas/asset.yaml#/schemas/AssetList' + '/v1/asset/{assetId}': + parameters: + - name: assetId + in: path + description: Id of the Asset + required: true + schema: + type: integer + format: int32 + get: + tags: + - assets + description: Get an existing Asset + operationId: getAsset + security: + - ApiKeyAuth: [] + responses: + 200: + description: The existing Asset + content: + application/json: + schema: + $ref: './schemas/asset.yaml#/schemas/AssetDetails' + '/v1/advertiser/{advertiserId}/asset': + parameters: + - name: advertiserId + in: path + description: Id of the Advertiser + required: true + schema: + type: integer + format: int32 + get: + tags: + - assets + description: List Assets for Advertiser + operationId: listAdvertiserAssets + security: + - ApiKeyAuth: [] + parameters: + - name: pageSize + in: query + description: The size of the page to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + - name: page + in: query + description: The page number to be returned + required: false + schema: + type: integer + format: int32 + nullable: true + responses: + 200: + description: Paged list of Assets for Advertiser + content: + application/json: + schema: + $ref: './schemas/asset.yaml#/schemas/AssetList' + post: + tags: + - assets + description: Create Asset + operationId: createAsset + security: + - ApiKeyAuth: [] + requestBody: + content: + application/json: + schema: + $ref: './schemas/asset.yaml#/schemas/AssetInput' + responses: + 200: + description: Asset Created + content: + application/json: + schema: + $ref: './schemas/asset.yaml#/schemas/Asset' + '/v1/asset/{assetId}/delete': + parameters: + - name: assetId + in: path + description: Id of the Asset + required: true + schema: + type: integer + format: int32 + post: + tags: + - assets + description: Delete an existing Asset + operationId: deleteAsset + security: + - ApiKeyAuth: [] + responses: + 200: + description: Successfully Deleted + '/v1/asset/{assetId}/upload': + parameters: + - name: assetId + in: path + description: Id of the Asset + required: true + schema: + type: integer + format: int32 + post: + tags: + - assets + description: Upload content to an existing Asset + operationId: uploadAssetContent + security: + - ApiKeyAuth: [] + parameters: + - name: timestamp + in: query + description: Milliseconds since epoch from asset creation + required: true + schema: + type: integer + format: int32 + - name: signature + in: query + description: Signing hash from asset creation + required: true + schema: + type: string + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: This must be an image file + responses: + 200: + description: Successfully Uploaded components: schemas: CreativeTemplateUpdate: $ref: './schemas/creative-template.yaml#/schemas/CreativeTemplateUpdate' securitySchemes: - ApiKeyAuth: - type: apiKey - in: header - name: X-Adzerk-ApiKey + $ref: './components/security-schemes.yaml#/components/securitySchemes' diff --git a/management/schemas/ad.yaml b/management/schemas/ad.yaml index fb58ad9..9c19500 100644 --- a/management/schemas/ad.yaml +++ b/management/schemas/ad.yaml @@ -1,28 +1,13 @@ schemas: - - Ad: + AdBase: type: object required: - - CampaignId - Creative - IsActive - - FlightId properties: - CampaignId: - type: integer - format: int32 - nullable: true Creative: $ref: './creative.yaml#/schemas/Creative' nullable: true - FlightId: - type: integer - format: int32 - nullable: true - Id: - type: integer - format: int32 - nullable: true IsActive: type: boolean default: false @@ -41,6 +26,7 @@ schemas: DistributionType: type: integer format: int32 + enum: [1, 2, 3] Percentage: type: integer format: int32 @@ -84,6 +70,7 @@ schemas: type: integer format: int32 nullable: true + enum: [1, 2, 3, 7, 8, 9, 10] Goal: type: integer format: int32 @@ -109,6 +96,7 @@ schemas: type: integer format: int32 nullable: true + enum: [1, 2, 3] Price: type: number format: float @@ -137,6 +125,34 @@ schemas: format: int32 nullable: true + AdInput: + allOf: + - $ref: '#/schemas/AdBase' + - type: object + additionalProperties: true + + Ad: + allOf: + - $ref: '#/schemas/AdBase' + - type: object + required: + - Id + - FlightId + - CampaignId + properties: + CampaignId: + type: integer + format: int32 + nullable: true + FlightId: + type: integer + format: int32 + nullable: true + Id: + type: integer + format: int32 + nullable: true + AdList: type: object properties: diff --git a/management/schemas/asset.yaml b/management/schemas/asset.yaml new file mode 100644 index 0000000..4f17b77 --- /dev/null +++ b/management/schemas/asset.yaml @@ -0,0 +1,108 @@ +schemas: + AssetBase: + type: object + required: + - Name + - Type + properties: + Name: + type: string + Type: + type: string + enum: ['video', 'image'] + + AssetInput: + allOf: + - $ref: '#/schemas/AssetBase' + - type: object + properties: + ContentURL: + type: string + nullable: true + optional: true + + Asset: + allOf: + - $ref: '#/schemas/AssetBase' + - type: object + required: + - Id + - AdvertiserId + properties: + AdvertiserId: + type: integer + format: int32 + nullable: true + Id: + type: integer + format: int32 + nullable: true + IsDeleted: + type: boolean + nullable: true + - oneOf: + - type: object + required: + - Status + - UploadURL + properties: + Status: + type: string + enum: ['pending'] + UploadURL: + type: string + format: uri + nullable: true + - type: object + required: + - Status + - ContentURL + properties: + Status: + type: string + enum: ['ready'] + ContentURL: + type: string + format: uri + nullable: true + + AssetDetails: + allOf: + - $ref: '#/schemas/Asset' + - type: object + properties: + Metadata: + type: object + properties: + Height: + type: integer + Width: + type: integer + FileExtension: + type: string + AspectRatio: + type: string + Duration: + type: number + PlaybackId: + type: string + + AssetList: + type: object + properties: + page: + type: integer + format: int32 + pageSize: + type: integer + format: int32 + totalPages: + type: integer + format: int32 + totalItems: + type: integer + format: int64 + items: + type: array + items: + $ref: '#/schemas/Asset' diff --git a/management/schemas/campaign.yaml b/management/schemas/campaign.yaml index a395d44..4d54f4b 100644 --- a/management/schemas/campaign.yaml +++ b/management/schemas/campaign.yaml @@ -1,5 +1,4 @@ schemas: - CampaignBase: type: object required: @@ -56,9 +55,6 @@ schemas: format: int32 minimum: 0 nullable: true - Id: - type: integer - nullable: true CustomFieldsJson: type: string nullable: true @@ -67,35 +63,52 @@ schemas: nullable: true readOnly: true + CampaignInput: + allOf: + - $ref: '#/schemas/CampaignBase' + - type: object + properties: + Flights: + type: array + items: + type: object + nullable: true + Campaign: allOf: - $ref: '#/schemas/CampaignBase' - type: object + required: + - Id properties: + Id: + type: integer + format: int32 + nullable: true SalespersonId: type: integer format: int32 nullable: true - StartDate: - type: string - default: 1/1/2018 - deprecated: true - readOnly: true Flights: type: array items: type: object nullable: true + StartDate: + type: string + default: 1/1/2018 + deprecated: true + readOnly: true EndDate: type: string + deprecated: true nullable: true readOnly: true - deprecated: true EndDateISO: type: string - readOnly: true deprecated: true nullable: true + readOnly: true Price: type: number deprecated: true diff --git a/management/schemas/flight.yaml b/management/schemas/flight.yaml index 292f66d..4e4e68b 100644 --- a/management/schemas/flight.yaml +++ b/management/schemas/flight.yaml @@ -364,4 +364,4 @@ schemas: Jobs: type: array items: - $ref: './job.yaml#/schemas/JobOutput' + $ref: './job.yaml#/schemas/Job' diff --git a/management/schemas/job.yaml b/management/schemas/job.yaml index bd3b723..985a8f1 100644 --- a/management/schemas/job.yaml +++ b/management/schemas/job.yaml @@ -1,23 +1,135 @@ schemas: + Override: + type: object + properties: + source: + type: string + target: + type: array + items: + type: string + op: + type: string + enum: ['constant', 'literal', 'stringify', 'stringify-array'] - JobInput: + CreateAdsFromProductsTask: type: object - required: - - TaskId properties: TaskId: type: string - maxLength: 100 + enum: ['create-ads-from-products'] TaskArgs: type: object - PartitionId: - type: string + properties: + ProductUris: + type: array + items: + type: string + format: uri + AdTemplateUri: + type: string + format: uri + FlightId: + type: integer + format: int32 + Overrides: + type: object + description: 'A map of ProductUri keys with Override values' + additionalProperties: + $ref: '#/schemas/Override' - JobOutput: + JobInput: + allOf: + - oneOf: + - $ref: '#/schemas/CreateAdsFromProductsTask' + - type: object + required: + - TaskId + properties: + PartitionId: + type: string + + SuccessfulOutput: + type: object + properties: + errors: + type: array + items: + type: object + properties: + required: + - message + message: + type: string + + CompletedOutput: type: object required: - - Id + - AdIds properties: - Id: + AdIds: + type: array + items: + type: integer + format: int32 + + FailedOutput: + type: object + required: + - errors + properties: + errors: + type: array + items: + type: object + properties: + required: + - message + message: + type: string + + Job: + allOf: + - oneOf: + - $ref: '#/schemas/CreateAdsFromProductsTask' + - type: object + required: + - TaskId + properties: + CompletedTime: + type: string + NetworkId: + type: integer + Status: + type: string + AvailableTime: + type: string + Output: + type: object + anyOf: + - $ref: '#/schemas/CompletedOutput' + - $ref: '#/schemas/FailedOutput' + Id: + type: integer + PartitionId: + type: string + + JobList: + type: object + properties: + page: + type: integer + format: int32 + pageSize: type: integer format: int32 + totalPages: + type: integer + format: int32 + totalItems: + type: integer + format: int64 + items: + type: array + items: + $ref: '#/schemas/Job'