Skip to content

Instantly share code, notes, and snippets.

@fesor
Forked from daryailyushina/approve_owner.md
Created February 10, 2016 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fesor/2d07abec5d4b8218bcfb to your computer and use it in GitHub Desktop.
Save fesor/2d07abec5d4b8218bcfb to your computer and use it in GitHub Desktop.
Title Change password
URL /api/users/passwordChange
Method POST
Headers Authorization=Bearer token
Content-type: application/json
Params password=current password
newPassword=new password
Data Params example
{
"password": "password",
"newPassword": "pass"
}
Success Response example
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9"
}
Title Coupon add/edit photo
Description Access rights: oner, admin, employee
URL /api/coupons/{id}/photoEditing
Method POST
Headers Authorization=Bearer token
Params multipart
file
Data Params example
{
"file":"image.jpg"
}
Success Response example
{
"success": "true"
}
Title Coupon cancellation
URL /api/owners/couponCancellation/{couponId}
Method POST
Description Access rights: oner, admin
Headers Authorization=Bearer token
Success Response example
{"entity":{
"newPrice":140,
"id":19,
"title":"Test title",
"price":200,
"discount":30,
"count":5,
"timeAvailable":"2000-07-01T16:30:00+0000",
"status":"closed",
"startDate":"2000-07-01T12:00:00+0000",
"verificationCode":"545krte",
"category":"food",
"shop":{
"id":14,
"name":"name",
"address":{
"location":"442 Strand, London WC2R 0QU, United Kingdom",
"lat":51.508872,
"lng":-0.125346
},
"description":"The best shop",
"openingHours":[{
"openTime":"09:00 am",
"closeTime":"11:30 pm",
"day":"Wednesday"
},
...
{
"openTime":"09:00 am",
"closeTime":"00:30 pm",
"day":"Friday"
}],
"phoneNumber":"+23423423424"
},
"description":"description"
}
}
Title Coupons list/Coupons Search
URL /api/coupons
Method GET
Headers Authorization=Bearer token
Content-type: application/json
Params customer
filter[category]=category- optional
filter[tracking]=true - for option "tracked" - optional
no parameters for option "all"

owner
filter[month]=month- optional
filter[owner]=true
filter[status]=coupon_status("pending","inProgress","finished")

search
filter[title]=shop or coupon title- optional

get distance from shop
position=user current position- optional("lng lat")
Data Params optional
example
{
"filter[status]": "finished",
"filter[ownerId]": "2",
"position": "27.5133915 53.9129273"}
Success Response example
[
{
"newPrice":140,
"availableCount":5,
"id":25,
"title":"Test titjjle",
"price":200,
"discount":30,
"count":5,
"timeAvailable":"2016-02-05T14:50:04+0000",
"status":"finished",
"startDate":"2000-07-01T12:00:00+0000",
"verificationCode":"545krte",
"category":"food",
"shop":{
"id":28,
"name":"shop",
"address":{
"location":"442 Strand, London WC2R 0QU, United Kingdom",
"point":"SRID=4326;POINT(27.5130862 53.9192823)",
"shopDistance":"707.617763355"
},
"description":"The best shop ttt",
"openingHours":[{
"openTime":"00:00 am",
"closeTime":"00:30 pm",
"day":"Monday"
},{
...
],"file":{
"image":"/uploads/shop/28.jpg",
"filePath":"http://104.131.56.228/uploads/coupon/25.jpg"
}},
"file":{
"image":"/uploads/coupon/25.jpg",
"filePath":"http://104.131.56.228/uploads/coupon/25.jpg"
},
"description":"description"
}]
Title Create coupon
Description Access rights: oner, admin, employee
URL /api/coupons
Method POST
Headers Authorization=Bearer token
Content-type: application/json
Params title=title
price=price
discount=discount - (1..100)
count=count
startDate=DateTime
verificationCode=verificationCode
category=category
timeAvailable=DateTime
description=description
Data Params example
{
"title":"Test title",
"price":"200",
"discount":"30",
"count":"5",
"startDate":"2016-01-01T12:00:00+0000",
"verificationCode":"545krte",
"category":"food",
"timeAvailable":"2016-07-01T16:30:00+0000",
"description": "description"
}
Success Response example
{
"entity": {
"id": 12,
"title": "title",
"newPrice": 140,
"price": 200,
"discount": 30,
"count": 5,
"timeAvailable": "2000-07-01T16:30:00+0000",
"status": "closed",
"startDate": "2000-07-01T12:00:00+0000",
"verificationCode": "545krte",
"category": "food",
"description": "description"
}
"shop": {
"id": 1,
"name": "name",
"address": {},
"description": "shop description",
"openingHours": [],
"phoneNumber": "+23486424"
}
}
}
Title Create shop
Description Access rights: owner
URL /api/shops
Method POST
Headers Authorization=Bearer token
Content-type: application/json
Params name=name
description=description
phoneNumbers=array of phoneNumbers
address:{location=address} - valid address string
category=category

opening hours - for 7 days
openTime=time - string
closeTime=time - string
day=dayName
Data Params example
{
"name": "name",
"description": "description",
"category":"Food",
"phoneNumbers":["+234242343","+111111111"],
"address":{"location":"442 Strand, London WC2R 0QU, United Kingdom"},
"openingHours": [{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Monday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Sunday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Tuesday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Wednesday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Thursday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Friday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Saturday"
}]
}
Success Response example
{
"id": 47,
"name": "name",
"category": "Food",
"address": {
"location": "442 Strand, London WC2R 0QU, United Kingdom",
"point":"POINT(-0.1253459 51.5088718)"
},
"description": "shop description",
"openingHours": [{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Monday"
},
...
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Saturday"
}
],
"phoneNumbers":["+234242343","+111111111"],
}
Title Customer old coupons list
URL customers/oldCoupons
Method GET
Headers Authorization=Bearer token
Success Response example
[
{
"status": "realized",
"coupon": {
"newPrice": 140,
"id": 9,
"title": "Test title",
"price": 200,
"discount": 30,
"count": 4,
"timeAvailable": "2000-07-01T16:30:00+0000",
"status": "active",
"startDate": "2000-07-01T12:00:00+0000",
"verificationCode": "545krte",
"category": "food",
"shop": {
"id": 13,
"name": "llee0hidlole",
"address": {
"location": "442 Strand, London WC2R 0QU, United Kingdom",
"lat": 51.508872,
"lng": -0.125346
},
"description": "The best shop",
"openingHours": [],
"phoneNumber": "+23423423424",
"file": "/uploads/shop/13.jpg"
},
"description": "description"
}
},
{}
]
Title Edit coupon
Description Access rights: oner, admin, employee
URL /api/coupons/{id}
Method PUT
Headers Authorization=Bearer token
Content-type: application/json
Params title=title - changeble
price=price - changeble
discount=discount - (1..100) - changeble
count=count - changeble
startDate=DateTime - changeble
verificationCode=verificationCode - changeble
category=category
timeAvailable=DateTime - changeble
description=description - changeble
Data Params example
{
"title":"Test title",
"price":"200",
"discount":"30" ,
"count":"5",
"startDate":"2016-01-01T12:00:00+0000",
"verificationCode":"545krte",
"category":"food",
"timeAvailable":"2016-07-01T16:30:00+0000",
"description": "description"
}
Success Response example
{
"entity": {
"id": 12,
"title": "title",
"newPrice": 140,
"price": 200,
"discount": 30,
"count": 5,
"timeAvailable": "2000-07-01T16:30:00+0000",
"status": "closed",
"startDate": "2000-07-01T12:00:00+0000",
"verificationCode": "545krte",
"category": "food",
"description": "description"
}
"shop": {
"id": 1,
"name": "name",
"address": {},
"description": "shop description",
"openingHours": [],
"phoneNumber": "+23486424"
}
}
}
Title Change employee to admin
URL /api/owners/employeeToAdmin
Method POST
Description Access rights: oner
Headers Authorization=Bearer token
Content-type: application/json
Params employeeId=id
Data Params example
{
"employeeId":"2"
}
Success Response example
{
"id":2,
"username":"userName",
"email":"email@test.com",
"login":"email@test.com",
"role":"admin",
"favouriteShops":[],
"age":23,
"birthDate":"1992-07-01T00:00:00+0000",
"sex":"male",
"discr":"customer"
}
Title User favourite shops
URL /api/users/favouriteShops
Method GET
Headers Authorization=Bearer token
Success Response example
[{
"shop":{
"id":4,
"name":"llee0ooohdlole",
"address":{
"location":"442 Strand, London WC2R 0QU, United Kingdom",
"lat":51.508872,
"lng":-0.125346
},
"description":"The best shop",
"openingHours": [{
"openTime":"09:00 am",
"closeTime":"11:30 pm",
"day":"Monday"},
...
],
"phoneNumber":"+23423423424"
},
"activeCoupons":0
},
{
"shop":{
...
},
"activeCoupons":0
},
...
]
Title Find user by id
URL /api/users/{id}
Method GET
Headers Authorization=Bearer token
Success Response example
{
"entity":
{
"id": 4,
"username": "username",
"email": "email@test.com",
"role": "customer",
"favourite_shops": [],
"coupons": [],
"birth_date": "1991-09-08T00:00:00+0000",
"sex": "male",
"discr": "customer"
}
}
Title Login/ Facebook login
URL /api/sessions
Method POST
Headers Content-type: application/json
Params simple login
identity=email
password=pass

facebook login
identity=token
provider=facebook
Data Params simple login
example
{
"identity": "email",
"password": "pass"
}

facebook login
example
{
"identity": "CAAYHq69nKZBEBAOBNak7ZA…",
"provider":"facebook"
}
Success Response example
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9"
}
Title Owner add employee
Headers Authorization=Bearer token
Content-type: application/json
URL /api/owners/employeeAdding
Method POST
Params employeeId=id
Data Params example
{
"employeeId": "2",
}
Success Response example
{
"entity": {
"id": 2,
"username": "name",
"email": "email@test.com",
"login": "email@test.com",
"role": "employee",
"favouriteShops": [],
"age": 20,
"birthDate": "1995-07-01T00:00:00+0000",
"sex": "female",
"owner": {
"id": 33,
"username": "name",
"email": "email@test.com",
"login": "email@test.com",
"role": "owner",
"favouriteShops": [],
"organizationNumber": "hrthth546",
"address": "London 24-14",
"discr": "owner"
},
"discr": "customer"
}
}
Title Owner show employee list
Headers Authorization=Bearer token
URL /api/owners/employeeList
Method GET
Success Response example
[{
"id": 12,
"username": "name",
"email": "email@test.com",
"login": "email@test.com",
"role": "admin",
"favouriteShops": [],
"age": 30,
"birthDate": "1985-07-01T00:00:00+0000",
"sex": "female",
"discr": "customer"
},
{
"id": 2,
"username": "name",
"email": "email@test.com",
"login": "email@test.com",
"role": "employee",
"favouriteShops": [],
"age": 23,
"birthDate": "1992-07-01T00:00:00+0000",
"sex": "male",
"discr": "customer"
}]
Title QR code generator
URL /qrcode/{verificationCode}.{extension}
Method GET
Success Response QR code
Title Reset password
Description automaticly generate new password and send it to user via email
URL /api/users/passwordResetting
Method POST
Headers Content-type: application/json
Params email=user_email
Data Params example
{
"email": "email@gmail.com"
}
Success Response example
{
"success":"true"
}
Title User set shop rating
URL /api/users/shopRating
Method POST
Headers Authorization=Bearer token
Content-type: application/json
Params shopId=id
rating: rating(1, ..., 5)
Data Params example
{
"shopId":"14",
"rating":"5"
}
Success Response example
{
"success": true
}
Title Shop add/edit photo
Description Access rights: oner, admin
URL /api/shops/photoEditing
Method POST
Headers Authorization=Bearer token
Params multipart
file
Data Params example
{
"file":"image.jpg"
}
Success Response example
{
"success": "true"
}
Title Shop update
URL /api/shops
Method PUT
Headers Authorization=Bearer token
Content-type: application/json
Params name=name
description=description
phoneNumbers=array
category=category
address:{location=address} - valid address string

opening hours - for 7 days
openTime=time - string
closeTime=time - string
day=dayName
Data Params example
{
"name": "name",
"category": "Food",
"description": "description",
"phoneNumbers":["+234242343","+4444444"],
"address":{"location":"442 Strand, London WC2R 0QU, United Kingdom"},
"openingHours": [{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Monday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Sunday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Tuesday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Wednesday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Thursday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Friday"
},
{
"openTime": "09:00 am",
"closeTime": "11:30 pm",
"day": "Saturday"
}]
}
Success Response example
{
"id":37,
"name":"name",
"address":{
"location":"442 Strand, London WC2R 0QU, United Kingdom",
"point":"POINT(-0.1253459 51.5088718)",
"shopDistance":"1874756.5809971"},
"description":"description",
"openingHours":[{
"openTime":"00:00 am",
"closeTime":"00:30 pm",
"day":"Monday"},
...
],
"phoneNumbers":["+234242343","+4444444"],
"file":{"image":"/uploads/shop/37.jpg",
"filePath":"http://104.131.56.228/uploads/shop/37.jpg"},
"category":"Food"
}
Title Show coupon info and statistics
Description СustomersInfo statistics shows only for coupons with status “realized”
URL /api/coupons/{id}
Method GET
Headers Authorization=Bearer token
Content-type: application/json
Success Response example
{
"entity":{
"newPrice":1020,
"availableCount":11,
"id":25,
"title":"Title",
"price":1200,
"discount":15,
"count":11,
"timeAvailable":"2016-02-29T09:16:04+0000",
"status":"inProgress",
"startDate":"2016-03-04T09:16:04+0000",
"verificationCode":"3333333",
"category":"food",
"shop":{
"id":28,
"name":"shop",
"address":{
"location":"442 Strand, London WC2R 0QU, United Kingdom",
"point":"SRID=4326;POINT(27.5130862 53.9192823)",
"shopDistance":"707.617763355"
},
"description":"The best shop",
"openingHours":[{
"openTime":"00:00 am",
"closeTime":"00:30 pm",
"day":"Monday"},...
],
"file":{}},"file":{
"image":"/uploads/coupon/25.jpg",
"filePath":"http://104.131.56.228/uploads/coupon/25.jpg"
},
"description":"description"
},
"statistics":{
"couponsInfo":{
"realized":0,
"expiresCount":11,
"expiresTime":1697723
}
}
}
Title Show shop
URL /api/shops
Method GET
Headers Authorization=Bearer token
Params show all shops by distance
filter[lat]=current_lat_coordinate
filter[lng]=current_lng_coordinate
filter[radius]=distance in metres

get shop by "id"
filter[id]=shop_id
Data Params show all shops by distance
example
{
"filter[lng]": "27.5133915",
"filter[lat]": "53.9129273",
"filter[radius]": "500",
}

get shop by id
example
{
"filter[id]": "14",
}
Success Response "show all shops by distance" - example
[{
"id": 25,
"name": "me",
"address": {
"location": "vulica Biruzova 10\u0410, Minsk",
"point": "SRID=4326;POINT(27.5133915 53.9129273)"
},
"description": "The best shop",
"openingHours": [{
"openTime": "00:00 am",
"closeTime": "00:30 pm",
"day": "Monday"
},
...
],
"phoneNumber": "+23423423424tt"
},
{
"id": 26,
"name": "shopName",
"address": {
...
}
]

"get shop by id" example
{"entity":{
"id":14,
"name":"shop_name",
"address":{
"location":"442 Strand, London WC2R 0QU, United Kingdom"
},
"description":"The best shop",
"openingHours":[{
"openTime":"09:00 am",
"closeTime":"11:30 pm",
"day":"Wednesday"
},
...
],
"phoneNumber":"+23423423424444"
},
"rating":[{
"rating":"3.7500000000000000"
}]
}
Title Show usesr settings
Headers Authorization=Bearer token
URL /api/users
Method GET
Success Response example
{
"entity": {
"id": 2,
"username": "name",
"email": "email@test.com",
"role": "customer",
"favouriteShops": [],
"age": 25,
"birthDate": "1990-07-01T00:00:00+0000",
"sex": "male",
"discr": "customer"
}
}
Title User follow shop
Headers Authorization=Bearer token
Content-type: application/json
URL /api/users/shopFollowing
Method POST
Params shopId=id
Data Params example
{
"shopId": "id"
}
Success Response example
{
"id": 33,
"username": "name",
"email": "email@test.com",
"login": "email@test.com",
"role": "owner",
"favouriteShops": [{
"id": 4,
"name": "name",
"address": {
"location": "442 Strand, London WC2R 0QU, United Kingdom",
"lat": 51.508872,
"lng": -0.125346
},
"description": "description",
"openingHours": [],
"phoneNumber": "+23423423424"
},
{
"id": 7,
"name": "name",
"address": {
"location": "442 Strand, London WC2R 0QU, United Kingdom",
"lat": 51.508872,
"lng": -0.125346
},
"description": "description",
"openingHours": [],
"phoneNumbers": []
}],
"organizationNumber": "hrthth546",
"category": "Food",
"address": "London 24-14",
"discr": "owner"
}
Title User realize coupon
URL /api/users/couponRealization
Method POST
Headers Authorization=Bearer token
Content-type: application/json
Params verificationCode=545krte
couponId=10
Data Params example
{
"verificationCode":"545krte",
"couponId":"10"
}
Success Response example
{
"entity": {
"status": "realized",
"coupon": {
"newPrice": 140,
"id": 9,
"title": "Test title",
"price": 200,
"discount": 30,
"count": 4,
"timeAvailable": "2000-07-01T16:30:00+0000",
"status": "active",
"startDate": "2000-07-01T12:00:00+0000",
"verificationCode": "545krte",
"category": "food",
"shop": {
"id": 13,
"name": "llee0hidlole",
"address": {
"location": "442 Strand, London WC2R 0QU, United Kingdom",
"lat": 51.508872,
"lng": -0.125346
},
"description": "The best shop",
"openingHours": [],
"phoneNumber": "+23423423424",
"file": "/uploads/shop/13.jpg"
},
"description": "description"
}
}
}
Title User registration
URL /api/users
Method POST
Headers Content-type: application/json
Params customer
username=username
password=password
email=email@test.com
role=customer
sex=male/female
birthDate=Y-M-d

owner
username=username
password=pass
email=email@test.com
role=owner
address=address
organizationNumber=organizationNumber
Data Params customer
example
{
"username": "username",
"password": "pass",
"email":"email@test.com",
"role": "customer",
"sex":"male",
"birthDate":"1990-07-01"
}

owner
example
{
"username": " username ",
"password": "pass",
"email": "email@test.com",
"role": "owner",
"address":"address",
"organizationNumber":"organizationNumber"
}
Success Response example
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9"
}
Title User track coupon
URL /api/users/couponTracking/{coupon_id}
Method GET
Headers Authorization=Bearer token
Success Response example
{
"entity": {
"status": "tracking",
"coupon": {
"newPrice": 140,
"id": 9,
"title": "Test title",
"price": 200,
"discount": 30,
"count": 4,
"timeAvailable": "2000-07-01T16:30:00+0000",
"status": "active",
"startDate": "2000-07-01T12:00:00+0000",
"verificationCode": "545krte",
"category": "food",
"shop": {
"id": 13,
"name": "llee0hidlole",
"address": {
"location": "442 Strand, London WC2R 0QU, United Kingdom",
"lat": 51.508872,
"lng": -0.125346
},
"description": "The best shop",
"openingHours": [],
"phoneNumber": "+23423423424",
"file": "/uploads/shop/13.jpg"
},
"description": "description"
}
}
}
Title User update settings
Headers Authorization=Bearer token
Content-type: application/json
URL /api/users
Method PUT
Params username=username
email=email

optional
organizationNumber=organizationNumber - if user has role owner
Data Params example
{
"username": "name",
"email": "email@test.com",
"organizationNumber": "3545654" - optional
}
Success Response example
{
"entity": {
"id": 2,
"username": "name",
"email": "email@test.com",
"role": "customer",
"favouriteShops": [],
"age": 23,
"birthDate": "1992-07-01T00:00:00+0000",
"sex": "male",
"discr": "customer"
},
"token": "eyJhbGciOiJSUzI1NiIsInR5c…"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment