Scottsdale Gun Club API
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
// @Todo: describe
Authentication
Getting an Admin Token
Most api requests will need an admin token. Get an admin token by posting a json object with the username and password of an admin user that has api rights & rights to the resource you are requesting. make request to
POST http://{domain}/rest/V1/integration/admin/token
POST http://sgcdev.primeview.com/rest/V1/integration/admin/token
Request
http://sgcdev.primeview.com/rest/V1/integration/admin/tokenHeaders
* Content-Type : application/jsonPost Body
{"username":"pvadmin","password":"S}xb@VHh+:6"}
Response
"l66glfo9lkm9r9134nl8mltipvgwa9a3"
Event *Classes* Inventory
updating class inventory
PUT http://sgcdev.primeview.com/rest/default/V1/products/{sku}/stockItems/1
Request
Headers
* Authorization : Bearer {token}
* Accepts : application/json
* Content-Type : application/json
PUT http://{domain}/rest/default/V1/products/{sku}/stockItems/1
The json body contains a stockItem object with qty which stands for the "Available Seats" and max_sale_qty which stands for "Max Available Seats"
{
"stockItem":{
"qty":20,
"max_sale_qty":20
}
}
Response
[]
(function($){
alert('test');
})(jQuery.noConflict())
getting class inventory
GET http://{domain}/rest/default/V1/stockItems/{sku}
GET http://sgcdev.primeview.com/rest/default/V1/stockItems/{sku}
Request
Headers
* Authorization : Bearer {token}
* Accepts : application/json
* Content-Type : application/json
Response
{
"item_id":701,
"product_id":0,
"stock_id":1,
"qty":20,
"is_in_stock":true,
"is_qty_decimal":false,
"show_default_notification_message":false,
"use_config_min_qty":true,
"min_qty":0,
"use_config_min_sale_qty":1,
"min_sale_qty":1,
"use_config_max_sale_qty":false,
"max_sale_qty":20,
"use_config_backorders":true,
"backorders":0,
"use_config_notify_stock_qty":true,
"notify_stock_qty":1,
"use_config_qty_increments":false,
"qty_increments":0,
"use_config_enable_qty_inc":true,
"enable_qty_increments":false,
"use_config_manage_stock":true,
"manage_stock":true,
"low_stock_date":null,
"is_decimal_divided":false,
"stock_status_changed_auto":0
}
Membership
Update Magento Memberships
Post http://{domain}/rest/V1/api/members/update
POST http://sgcdev.primeview.com/rest/V1/api/members/update
Request
Headers
* Authorization : Bearer {token magento}
* Accepts : application/json
* Content-Type : application/json
{
"members": [
{
"email":"john@gmail.com",
"firstname":"customer-first-name",
"lastname":"customer-last-name",
"membership":"Red"
},
{
"email":"jane@yahoo.com",
"firstname":"test-customer-first-name",
"lastname":"test-customer-last-name",
"membership":"Family"
},
{
"email":"test@gmx.com",
"firstname":"John",
"lastname":"Doe",
"membership":"Standard"
},
{
"deactivate":"test@test.com,frank@bill.com,time@gmail.com"
}
]
}
Response
{
"msg":"members_update.json successfully written, 3member entries to be processed ,05/06/2020 11:06:53 am",
"res":866
}
Admin Sync
Membership Sync Configuration