Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
96a71bfa42 | |||
b6c972ded1 |
34
README.md
Normal file
34
README.md
Normal file
@ -0,0 +1,34 @@
|
||||
Snipe-IT API
|
||||
============
|
||||
|
||||
This is a simple API for accessing a Snipe-IT database.
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Installation is easy. Assuming you have a web server with PHP and a suitable
|
||||
database driver, simply put all the files in this repo in a web-accessible
|
||||
folder.
|
||||
|
||||
Edit the file database.php and add the connection settings for your Snipe-IT
|
||||
database.
|
||||
|
||||
On the mobile app, enter the full address for the API server. Include
|
||||
`http(s)://` and the trailing slash.
|
||||
|
||||
The API can be put in a subfolder of the main Snipe-IT installation, but it can
|
||||
also be setup on any server that can reach the database.
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
If you have a problem:
|
||||
|
||||
* Check you have the full path (with trailing slash) entered into the app.
|
||||
* Install PHP Composer and run `composer install`.
|
||||
* Check you can access the API from a computer. Go to the API folder/login.php.
|
||||
You should see JSON with an error message "Missing username.". If you see
|
||||
a different error, or there is no error, double-check the database settings,
|
||||
and try installing Composer dependencies.
|
||||
* If none of these solutions work, open an issue.
|
8
composer.json
Normal file → Executable file
8
composer.json
Normal file → Executable file
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "vendor/snipe-i-t-mobile-a-p-i",
|
||||
"description": "Description of project SnipeITMobileAPI.",
|
||||
"name": "netsyms/snipeit-mobile-api",
|
||||
"description": "Mobile API server for SnipeIT.",
|
||||
"authors": [
|
||||
{
|
||||
"name": "skylar",
|
||||
"email": "your@email.here"
|
||||
"name": "Skylar Ittner",
|
||||
"email": "admin@netsyms.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
|
0
composer.lock
generated
Normal file → Executable file
0
composer.lock
generated
Normal file → Executable file
0
database.php
Normal file → Executable file
0
database.php
Normal file → Executable file
0
dieifnotloggedin.php
Normal file → Executable file
0
dieifnotloggedin.php
Normal file → Executable file
0
getitem.php
Normal file → Executable file
0
getitem.php
Normal file → Executable file
0
getlocation.php
Normal file → Executable file
0
getlocation.php
Normal file → Executable file
0
getmodel.php
Normal file → Executable file
0
getmodel.php
Normal file → Executable file
0
getstatus.php
Normal file → Executable file
0
getstatus.php
Normal file → Executable file
0
nbproject/project.properties
Normal file → Executable file
0
nbproject/project.properties
Normal file → Executable file
0
nbproject/project.xml
Normal file → Executable file
0
nbproject/project.xml
Normal file → Executable file
0
readfrom.php
Normal file → Executable file
0
readfrom.php
Normal file → Executable file
0
required.php
Normal file → Executable file
0
required.php
Normal file → Executable file
0
search.php
Normal file → Executable file
0
search.php
Normal file → Executable file
4
updateitem.php
Normal file → Executable file
4
updateitem.php
Normal file → Executable file
@ -17,14 +17,14 @@ if (is_empty($id)) {
|
||||
// We need to create an item
|
||||
if ($from == 'assets') {
|
||||
$user_id = $database->select('users', 'id', ['username' => $_SESSION['user']])[0];
|
||||
$database->insert($from, ['name' => $_POST['name'], 'user_id' => $user_id, 'asset_tag' => $_POST['asset_tag'], 'rtd_location_id' => $_POST['location'], 'order_number' => $_POST['order_number'], 'status_id' => $_POST['status'], 'serial' => $_POST['serial'], 'model_id' => $_POST['model'], '#updated_at' => 'NOW()', '#created_at' => 'NOW()', '_snipeit_hard_drive_secure__y_n_' => $_POST['hdd_secure']]);
|
||||
$database->insert($from, ['name' => $_POST['name'], 'user_id' => $user_id, 'asset_tag' => $_POST['asset_tag'], 'rtd_location_id' => $_POST['location'], 'order_number' => $_POST['order_number'], 'status_id' => $_POST['status'], 'serial' => $_POST['serial'], 'model_id' => $_POST['model'], '#updated_at' => 'NOW()', '#created_at' => 'NOW()'/*, '_snipeit_hard_drive_secure__y_n_' => $_POST['hdd_secure']*/]);
|
||||
} else {
|
||||
$database->insert($from, ['name' => $_POST['name'], 'location_id' => $_POST['location'], 'qty' => $_POST['qty'], 'order_number' => $_POST['order_number'], '#updated_at' => 'NOW()', '#created_at' => 'NOW()']);
|
||||
}
|
||||
} else {
|
||||
// Update an existing item by id
|
||||
if ($from == 'assets') {
|
||||
$database->update($from, ['name' => $_POST['name'], 'asset_tag' => $_POST['asset_tag'], 'rtd_location_id' => $_POST['location'], 'order_number' => $_POST['order_number'], 'status_id' => $_POST['status'], 'serial' => $_POST['serial'], 'model_id' => $_POST['model'], '#updated_at' => 'NOW()', '_snipeit_hard_drive_secure__y_n_' => $_POST['hdd_secure']], ['id' => $id]);
|
||||
$database->update($from, ['name' => $_POST['name'], 'asset_tag' => $_POST['asset_tag'], 'rtd_location_id' => $_POST['location'], 'order_number' => $_POST['order_number'], 'status_id' => $_POST['status'], 'serial' => $_POST['serial'], 'model_id' => $_POST['model'], '#updated_at' => 'NOW()'/*, '_snipeit_hard_drive_secure__y_n_' => $_POST['hdd_secure']*/], ['id' => $id]);
|
||||
} else {
|
||||
$database->update($from, ['name' => $_POST['name'], 'location_id' => $_POST['location'], 'qty' => $_POST['qty'], 'order_number' => $_POST['order_number'], '#updated_at' => 'NOW()'], ['id' => $id]);
|
||||
}
|
||||
|
0
vendor/autoload.php
vendored
Normal file → Executable file
0
vendor/autoload.php
vendored
Normal file → Executable file
0
vendor/catfan/medoo/.gitattributes
vendored
Normal file → Executable file
0
vendor/catfan/medoo/.gitattributes
vendored
Normal file → Executable file
0
vendor/catfan/medoo/.gitignore
vendored
Normal file → Executable file
0
vendor/catfan/medoo/.gitignore
vendored
Normal file → Executable file
0
vendor/catfan/medoo/LICENSE
vendored
Normal file → Executable file
0
vendor/catfan/medoo/LICENSE
vendored
Normal file → Executable file
0
vendor/catfan/medoo/README.md
vendored
Normal file → Executable file
0
vendor/catfan/medoo/README.md
vendored
Normal file → Executable file
0
vendor/catfan/medoo/composer.json
vendored
Normal file → Executable file
0
vendor/catfan/medoo/composer.json
vendored
Normal file → Executable file
0
vendor/catfan/medoo/medoo.php
vendored
Normal file → Executable file
0
vendor/catfan/medoo/medoo.php
vendored
Normal file → Executable file
0
vendor/catfan/medoo/src/medoo-logo.png
vendored
Normal file → Executable file
0
vendor/catfan/medoo/src/medoo-logo.png
vendored
Normal file → Executable file
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
0
vendor/composer/ClassLoader.php
vendored
Normal file → Executable file
0
vendor/composer/ClassLoader.php
vendored
Normal file → Executable file
0
vendor/composer/LICENSE
vendored
Normal file → Executable file
0
vendor/composer/LICENSE
vendored
Normal file → Executable file
0
vendor/composer/autoload_classmap.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_classmap.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_files.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_files.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_namespaces.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_namespaces.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_psr4.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_psr4.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_real.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_real.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_static.php
vendored
Normal file → Executable file
0
vendor/composer/autoload_static.php
vendored
Normal file → Executable file
0
vendor/composer/installed.json
vendored
Normal file → Executable file
0
vendor/composer/installed.json
vendored
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user