Files
openapi/referrer.yaml
T

384 lines
9.6 KiB
YAML

swagger: '2.0'
info:
version: v1.0
title: Referrer API
description: >-
A Referrer is an influencer who is generating Referrals for your store.
host: api.hanzo.io
schemes:
- https
consumes:
- application/json
produces:
- application/json
securityDefinitions:
oauth2:
type: oauth2
flow: password
scopes: {}
tokenUrl: 'https://api.hanzo.io/auth'
Authorization:
name: Authorization
type: apiKey
in: header
token:
name: token
type: apiKey
in: query
paths:
'/referrer/{id}':
parameters:
- name: id
in: path
required: true
type: string
patch:
operationId: PATCH_referrer-id
tags:
- Referrer
description: >-
Replaces a referrer piecemeal. Any fields not included are not affected.
parameters:
- name: body
in: body
schema:
$ref: '#/definitions/Referrer'
responses:
'200':
description: 'Everything is OK.'
schema:
$ref: '#/definitions/Referrer'
delete:
operationId: DELETE_referrer-id
tags:
- Referrer
description: >-
Permanently deletes the requested Referrer. Cannot be undone.
responses:
'204':
description: 'Everything is OK.'
schema:
type: object
properties: {}
get:
operationId: GET_referrer-id
tags:
- Referrer
description: >-
Gets the requested referrer.
parameters:
- name: token
in: query
required: false
type: string
- name: Accept
in: header
required: false
type: string
responses:
'200':
description: ''
schema:
$ref: '#/definitions/Referrer'
put:
operationId: PUT_referrer-id
tags:
- Referrer
description: >-
Replaces a referrer wholly. Any fields not included are blanked.
responses:
'200':
description: ''
schema:
$ref: '#/definitions/Referrer'
'/referrer/{id}/referrals':
parameters:
- name: id
in: path
required: true
type: string
get:
operationId: GET_referrer-id-referrals
description: >-
Gets a list of referrals generated by the requested referrer.
parameters:
- name: token
in: query
type: string
- name: Accept
in: header
type: string
responses:
'200':
description: 'Everything is OK.'
schema:
$ref: '#/definitions/ReferralArray'
/referrer:
get:
operationId: GET_referrer
description: >-
Gets a list of all available referrers.
parameters:
- name: token
in: query
type: string
- name: Accept
in: header
type: string
responses:
'200':
description: ''
schema:
$ref: '#/definitions/ReferrerArray'
post:
operationId: POST_referrer
description: >-
Creates a new referrer.
parameters:
- name: token
in: query
type: string
- name: body
in: body
schema:
$ref: '#/definitions/Referrer'
responses:
'201':
description: 'Everything is OK. New Referrer created.'
schema:
$ref: '#/definitions/Referrer'
'/referrer/{id}/transactions':
parameters:
- name: id
in: path
required: true
type: string
get:
operationId: GET_referrer-id-transactions
parameters:
- name: token
in: query
type: string
- name: Accept
in: header
type: string
responses:
'200':
description: ''
schema:
type: array
items:
type: object
properties:
id:
type: string
createdAt:
type: string
updatedAt:
type: string
userId:
type: string
type:
type: string
currency:
type: string
amount:
type: integer
test:
type: boolean
notes:
type: string
tags:
type: string
sourceId:
type: string
sourceKind:
type: string
examples:
application/json:
- id: 0gizw8Z2hEdk2
createdAt: '2016-04-15T04:54:44.119563Z'
updatedAt: '2016-04-15T04:54:44.119563Z'
userId: w4HZNvlwsQ2nO
type: deposit
currency: points
amount: 1
test: false
notes: Deposit from referral JJFx6Gku71rj
tags: referral
sourceId: JJFx6Gku71rj
sourceKind: referrer
/referral:
get:
operationId: GET_referral
description: >-
Returns all available referrals.
parameters:
- name: token
in: query
type: string
- name: Accept
in: header
type: string
responses:
'200':
description: ''
schema:
$ref: '#/definitions/ReferralArray'
post:
operationId: POST_referral
description: >-
Creates a new referral.
parameters:
- name: token
in: query
type: string
- name: body
in: body
schema:
$ref: '#/definitions/Referral'
responses:
'201':
description: ''
schema:
$ref: '#/definitions/Referral'
'/referral/{id}':
parameters:
- name: id
in: path
required: true
type: string
delete:
operationId: DELETE_referral-id
tags:
- Referral
description: >-
Deletes the requested Referral. Cannot be undone.
responses:
'204':
description: ''
get:
operationId: GET_referral-id
tags:
- Referral
description: >-
Gets the requested referral.
parameters:
- name: token
in: query
required: false
type: string
- name: Accept
in: header
required: false
type: string
responses:
'200':
description: ''
schema:
$ref: '#/definitions/Referrer'
patch:
operationId: PATCH_referral-id
tags:
- Referral
description: >-
Replaces the Referral piecemeal. Any fields not included are ignored.
parameters:
- name: token
in: query
required: false
type: string
- name: body
in: body
schema:
properties:
id:
type: string
type: object
example:
id: OxslNprfZvDW
- name: Accept
in: header
required: false
type: string
- name: Content-Type
in: header
required: false
type: string
responses:
'200':
description: ''
schema:
$ref: '#/definitions/Referrer'
put:
operationId: PUT_referral-id
tags:
- Referral
description: >-
Replaces the Referral wholly. Any fields not included will be blanked.
responses:
'200':
description: ''
schema:
$ref: '#/definitions/Referrer'
definitions:
Referrer:
title: Referrer
type: object
properties:
id:
type: string
description: The hanzo-assigned guid to identify this item.
createdAt:
type: string
description: The time this Referrer was created. Conforms to RFC3339.
updatedAt:
type: string
description: The time this Referrer was last updated. Conforms to RFC3339.
userId:
type: string
description: The ID denoting the user account of this referrer.
referralIds:
type: string
description: A list of IDs denoting the referrals this referrer has generated.
transactionsIds:
type: string
description: A list of IDs denoting the transactions this referrer has generated.
Referral:
title: Referral
type: object
properties:
id:
type: string
description: The hanzo-assigned guid to identify this item.
createdAt:
type: string
description: The time this Referral was created. Conforms to RFC3339.
updatedAt:
type: string
description: The time this Referral was last updated. Conforms to RFC3339.
userId:
type: string
description: The ID denoting the user account of this referral.
orderId:
type: string
description: The ID of the order that generated this referral.
referrerUserId:
type: string
description: The ID of the user that generated this referral.
referrerId:
type: string
description: The ID of the referrer that generated this referral.
ReferrerArray:
title: ReferrerArray
description: An array of Referrers
type: array
items:
$ref: '#/definitions/Referrer'
ReferralArray:
title: ReferralArray
description: An array of Referrals
type: array
items:
$ref: '#/definitions/Referral'