snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

[DISCUSSION] [WIP] API Development

Open mnemonicly opened this issue 9 years ago • 3 comments

Beginning a braindump of what the API might include and how it might look... will be working on this over the next few days.

/api/
 -hardware
    - list [ { GET /api/hardware/list?
        // Do we want to pass filter parameters to this? Or have something like /api/status/3/hardware?
        // What do we want in the full list?
        id,
        asset_tag,
        }, 
        {}, //etc
        {}
    ]
    - show { GET /api/hardware/show/{id}
        asset_tag,
        name,
        serial,
        image_url,
        model_number,
        eol,
        purchase_cost,
        purchase_date,
        notes,
        order_number,
        model_id,
        category_id,
        manufacturer_id,
        status_id,
        location_id, // Default and Current?
        category_id,
        company_id,
        assigned_id,
        assigned_type
        }
    - create { POST to /api/hardware/create/
       Post an object containing some or all of the above view values
       returns object {success: (true|false),  id: id of the created object, errors: json validation errors}
       }
    - edit { PATCH /api/hardware/{id} 
       PATCH an object containing some or all of the above view values
       returns object {success: (true|false),  id: id of the created object, errors: json validation errors}
       }
    - delete? { DELETE /api/hardware/{id}
           DELETE request to above url
           returns object { success: (true|false), json encoded error string on failure.}
       }
    - assigned { GET /api/hardware/{id}/checkout ?
          assigned_type,
          assigned_id,
          assignedTo->name()?  Or should we make that a separate request.

         returns null if available for checkout?
       }
    - checkout { POST /api/hardware/{id}/checkout
           assigned_type,
           assigned_id,
           checkout_date,
           expected_checkin,
           note

           returns object { success: (true|false), json encoded error string on failure.}          
      }
    - checkin { POST /api/hardware/{id}/checkin 
           status_id,
           note,
           checkin_date
      }
  -accessories

mnemonicly avatar Dec 30 '16 15:12 mnemonicly

I'm not so much concerned about the endpoints or routes, and I'm writing the documentation on all of that already. It's standard RESTy stuff, so not a lot of mystery there, really.

The bigger question is how people will expect to authenticate with it. API tokens, JWT, OAuth, etc. Does each user get an API token? Is there just a list of app-wide tokens? (If so, how does that affect the expectation that we currently have that there is always a user_id?)

snipe avatar Dec 30 '16 18:12 snipe

Moving this discussion to #176 for consistency, so previous participants are aware of the convo :)

snipe avatar Dec 30 '16 20:12 snipe

@snipe How do i send the automated backup database by mail....how do i set up in crons

ghost avatar Feb 17 '18 13:02 ghost