-
Notifications
You must be signed in to change notification settings - Fork 8
(Proposed) Item api endpoint
- name: text
- category: text or model
- subcategory: text or model (mapped to CTE types)
- spot: many-to-one model relation
- key: text
- value: text
- item: 1-to-1 model relation
Main item keys.
- i_is_active (publishing key)
- i_description (string 350 char limit)
- i_quantity
- i_model
- i_brand
- i_manual_url
- i_checkout_period (int days)
- i_is_stf
Does the item require a reservation?
- i_reservation_required ("true")
- i_reservation_notes
- i_reserve_url
Is there a "role" limitations on item usage?
- i_access_limit_role ("true")
If so, which role?
- i_access_role_students ("true")
- i_access_role_staff ("true")
- i_access_role_faculty ("true")
Item management group.. for Admin app?
- i_owner (uw group)
- description: text
- display_index : positive index
- image: ImageField
- item: an ItemModel many-to-one relation
- content_type: text
- creation_date: DateTimeField
- upload_user: text
- upload_application: text
Spot json would add an items attribute.
{
"id": "<spot id>",
"uri": "/api/v1/spot/<spot id>",
"name": "",
"type": ["study_room", "cafe"],
"location": {
"longitude": 0.00,
"latitude": 0.00,
"height_from_sea_level": 0.00,
"building_name": "",
"floor": 0,
"room_number": "",
"description": ""
},
"capacity": 0,
"display_access_restrictions": "",
"images": [
{
"id":"<image id>",
"url":"/api/v1/spot/<spot id>/image/<image id>",
"content-type":"image/...",
"width":0,
"height":0,
"creation_date":"Sun, 06 Nov 1994 08:49:37 GMT",
"modification_date":"Sun, 06 Nov 1994 08:49:37 GMT",
"upload_user":"user name",
"upload_application":"application name",
"thumbnail_root":"/api/v1/spot/<spot id>/image/<image id>/thumb",
"description": "Information about the image",
"display_index": 0
},
...
],
"available_hours":{
"monday": [ ["00:00", "10:00" ], ["11:00", "14:00"] ],
"tuesday": [ ["11:00", "14:00" ] ],
"wednesday": [ ["11:00", "14:00"] ],
"thursday": [ ["11:00", "14:00"] ],
"friday": [ ["11:00", "14:00"] ],
"saturday": [],
"sunday": [ ["11:00", "14:00"] ],
},
"organization": "",
"manager": "",
"extended_info": {
"whiteboards": true,
"field2": 0,
"field3": 0.00,
"field4": "",
},
"last_modified": "2012-07-13T05:00:00+00:00"
"items": [
{
"id": <item id>,
"name": "C-19074",
"category": "Digital Camera",
"subcategory": "",
"extended_info": {
"i_model": "Canon Powershot SD1100 IS",
"customer_type": "UW Student",
"auto_item_status": "active"
},
"images" : [
{
"id":"<image id>",
"url":"/api/v1/item/<item id>/image/<image id>",
"content-type":"image/...",
"creation_date":"Sun, 06 Nov 1994 08:49:37 GMT",
"upload_user":"user name",
"upload_application":"application name",
"thumbnail_root":"/api/v1/item/<item id>/image/<image id>/thumb",
"description": "Information about the image",
"display_index": 0
},
...
]
}
]
}
URI : /api/v1/item/<item id>/image/<image id>
Returns a JPG, PNG, or GIF.
URI : /api/v1/item/<item id>/image/<image id>/thumb/<width>x<height>
Retrieves a thumbnail of the specified height. Returns a 404 if an invalid height or width is provided.
URI : /api/v1/item/<item id>/image/
This accepts multipart form-data. The fields are image, description, and display_index. Upon creation, a URL at which the created resource can be accessed will be returned.
URI : /api/v1/item/<item id>/image/<image id>
This method will require a trusted oauth key and an Oauth-User that is a spotseeker_server admin.
On success a 200 will be returned, if the user has insufficient privileges a 401 error will be returned.
See https://github.com/uw-it-aca/scout-manager/blob/story/admin-01/scout_manager/dao/item.py