Billogram DiscountCode API
Documents the API for an imaginary Discount Code micro service
Version: 1.0.0
BasePath:/private1481/DiscountCodes/1.0.0
All rights reserved
http://apache.org/licenses/LICENSE-2.0.html
Access
[ Jump to Models ]
Table of Contents
create company (createCompany)
Creates a company for discounts
Consumes
This API call consumes the following media types via the request header:
Request body
Body Parameter — Create a company
Return type
Example data
Content-Type: application/json
{
"name" : "name",
"description" : "description",
"id" : 0
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
Responses
201
Success
Company
400
invalid input, could not create company
403
Not authorized to create
409
an existing item already exists
create discount codes (createDiscountCodes)
Creates one or more (as requested) discount codes in the system for the given company. If an account id is given the code is set to the valid state (activated). Otherwise it is put in the dormant state (precreated) and therefore available for later fetching/activation.
Query parameters
companyid (required)
Query Parameter — ID of the company offering discount format: int64
accountid (optional)
Query Parameter — ID of a personal discount format: int64
results (optional)
Query Parameter — Indicate if we want this method to return the created code object(s). False may be useful when just precreating codes default: true
instances (optional)
Query Parameter — Number of discount codes to create default: 1 format: int32
Return type
Example data
Content-Type: application/json
[ {
"offer" : 1,
"creationdate" : "2000-01-23T04:56:07.000+00:00",
"code" : "code",
"customerid" : 5,
"checksum" : 5,
"company" : 6,
"id" : 0,
"status" : "precreated"
}, {
"offer" : 1,
"creationdate" : "2000-01-23T04:56:07.000+00:00",
"code" : "code",
"customerid" : 5,
"checksum" : 5,
"company" : 6,
"id" : 0,
"status" : "precreated"
} ]
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
Responses
201
items created
400
invalid input, cannot create codes
403
Not authorized to create discount codes
409
an existing item already exists
create offer (createOffer)
Creates a discount offer
Consumes
This API call consumes the following media types via the request header:
Request body
Body Parameter — Create an offer with the given parameters
Query parameters
companyid (required)
Query Parameter — ID of the company offering discount format: int64
Return type
Example data
Content-Type: application/json
{
"createdby" : "createdby",
"callbackuri" : "http://example.com/aeiou",
"description" : "description",
"id" : 0,
"type" : "static",
"value" : "value"
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
Responses
200
Success
Offer
400
invalid input, could not create offer
403
Not authorized to create
Up
post /discountcodes/precreated
fetch precreated discount code (fetchDiscountCode)
Fetch a precreated unused discount code for a given account Creates one or more (as requested) discount codes in the system for the given company
Query parameters
companyid (required)
Query Parameter — ID of the company offering discount format: int64
accountid (required)
Query Parameter — Account id for the fetched discount code format: int64
Return type
Example data
Content-Type: application/json
{
"offer" : 1,
"creationdate" : "2000-01-23T04:56:07.000+00:00",
"code" : "code",
"customerid" : 5,
"checksum" : 5,
"company" : 6,
"id" : 0,
"status" : "precreated"
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
Responses
201
Precreated code retrieved
Discount
400
invalid input, cannot fetch codes
403
Not authorized to fetch discount code
500
No precreated unused codes available
Up
get /offers/{offeridpath}
get company offer (getCompanyOffer)
Retrieves a specific offer for given company.
Path parameters
offeridpath (required)
Path Parameter — ID of discount offering format: int64
Query parameters
companyid (required)
Query Parameter — ID of the company offering discount format: int64
Return type
Example data
Content-Type: application/json
{
"createdby" : "createdby",
"callbackuri" : "http://example.com/aeiou",
"description" : "description",
"id" : 0,
"type" : "static",
"value" : "value"
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
Responses
200
Success
Offer
403
Not authorized access
404
No offer found
get company offers (getCompanyOffers)
Retrieves offers for a given company.
Query parameters
companyid (required)
Query Parameter — ID of the company offering discount format: int64
Return type
Example data
Content-Type: application/json
[ {
"createdby" : "createdby",
"callbackuri" : "http://example.com/aeiou",
"description" : "description",
"id" : 0,
"type" : "static",
"value" : "value"
}, {
"createdby" : "createdby",
"callbackuri" : "http://example.com/aeiou",
"description" : "description",
"id" : 0,
"type" : "static",
"value" : "value"
} ]
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
Responses
200
search results matching criteria
204
No offer found
Up
get /discountcodes/{discountid}
get personal discount (getDiscount)
Retrieves a specific discount record.
Path parameters
discountid (required)
Path Parameter — ID of a personal discount format: int64
Return type
Example data
Content-Type: application/json
{
"offer" : 1,
"creationdate" : "2000-01-23T04:56:07.000+00:00",
"code" : "code",
"customerid" : 5,
"checksum" : 5,
"company" : 6,
"id" : 0,
"status" : "precreated"
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
Responses
200
Success
Discount
403
Not authorized access
404
No discount found
search for companies (searchCompanies)
Searches for companies by name. Only returns companies the user is authorized for.
Query parameters
companyname (optional)
Query Parameter — Name of company you are looking for. Exact match. If name is not given, returns id of all found companies authorized for.
Return type
Example data
Content-Type: application/json
[ {
"name" : "name",
"description" : "description",
"id" : 0
}, {
"name" : "name",
"description" : "description",
"id" : 0
} ]
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
Responses
200
search results matching criteria
204
No company found
search for discount codes (searchDiscountCodes)
By passing in the appropriate options, you can search for available discount codes in the system
Query parameters
companyid (optional)
Query Parameter — ID of the company offering discount format: int64
accountid (optional)
Query Parameter — ID of a personal discount format: int64
discountid (optional)
Query Parameter — ID of a personal discount format: int64
fromdate (optional)
Query Parameter — define the earliest date/time of searched discounts format: datetime
todate (optional)
Query Parameter — define the earliest date/time of searched discounts format: datetime
code (optional)
Query Parameter — Discount code
start (optional)
Query Parameter — Start point in result set. For paging together with limit. 0 based (first record is 0) default: 0 format: int32
limit (required)
Query Parameter — maximum number of records to return default: 100 format: int32
Return type
Example data
Content-Type: application/json
[ {
"offer" : 1,
"creationdate" : "2000-01-23T04:56:07.000+00:00",
"code" : "code",
"customerid" : 5,
"checksum" : 5,
"company" : 6,
"id" : 0,
"status" : "precreated"
}, {
"offer" : 1,
"creationdate" : "2000-01-23T04:56:07.000+00:00",
"code" : "code",
"customerid" : 5,
"checksum" : 5,
"company" : 6,
"id" : 0,
"status" : "precreated"
} ]
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
Responses
200
search results matching criteria
204
No discount found
400
bad input parameter
Up
post /discountcodes/{discountid}
change discount status (setDiscountStatus)
Sets status of a specific discount record. May also attach an account to the discount.
Path parameters
discountid (required)
Path Parameter — ID of a personal discount format: int64
Query parameters
accountid (optional)
Query Parameter — ID of a personal discount format: int64
status (optional)
Query Parameter — Wished new status. If not given the account id parameter is required and status will automatically be set to valid.
Return type
Example data
Content-Type: application/json
{
"offer" : 1,
"creationdate" : "2000-01-23T04:56:07.000+00:00",
"code" : "code",
"customerid" : 5,
"checksum" : 5,
"company" : 6,
"id" : 0,
"status" : "precreated"
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
Responses
200
Success
Discount
403
Not authorized access
404
No discount found
[ Jump to Methods ]
Table of Contents
Company
Discount
Offer
id
name
String Company name. Human readable.
description (optional)
String A short description of the company (i7n to come)
id
Long Id number of discount format: int64
company (optional)
Long Id number of company format: int64
offer
Long Id number of offer format: int64
customerid (optional)
Long Id number of the customer that received the discount format: int64
code
String The code given to the customer
creationdate
status (optional)
String Status of this discount code
precreated
dormant
valid
invalid
archived
checksum (optional)
Long Hash sum of the discount data format: int64
id
description
String Describes the discount in human readable text (i7n solution to come)
type (optional)
String Type of discount. Defines how the discount works (i7n solution to come)
static
percentageoneitem
percentageonebuy
external
value (optional)
String Internal machine readable definition of discount
callbackuri (optional)
String The callback uri for informing the company of discount creation The discount id and coupon code will be added as search parameters (discountid, couponcode). format: uri
createdby
String Identifies the creator of the offer