Compare commits

..

No commits in common. "master" and "hi" have entirely different histories.
master ... hi

33 changed files with 6 additions and 40 deletions

View File

@ -1,34 +0,0 @@
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 Executable file → Normal file
View File

@ -1,10 +1,10 @@
{
"name": "netsyms/snipeit-mobile-api",
"description": "Mobile API server for SnipeIT.",
"name": "vendor/snipe-i-t-mobile-a-p-i",
"description": "Description of project SnipeITMobileAPI.",
"authors": [
{
"name": "Skylar Ittner",
"email": "admin@netsyms.com"
"name": "skylar",
"email": "your@email.here"
}
],
"require": {

0
composer.lock generated Executable file → Normal file
View File

0
database.php Executable file → Normal file
View File

0
dieifnotloggedin.php Executable file → Normal file
View File

0
getitem.php Executable file → Normal file
View File

0
getlocation.php Executable file → Normal file
View File

0
getmodel.php Executable file → Normal file
View File

0
getstatus.php Executable file → Normal file
View File

0
login.php Executable file → Normal file
View File

0
nbproject/project.properties Executable file → Normal file
View File

0
nbproject/project.xml Executable file → Normal file
View File

0
readfrom.php Executable file → Normal file
View File

0
required.php Executable file → Normal file
View File

0
search.php Executable file → Normal file
View File

4
updateitem.php Executable file → Normal file
View 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 Executable file → Normal file
View File

0
vendor/catfan/medoo/.gitattributes vendored Executable file → Normal file
View File

0
vendor/catfan/medoo/.gitignore vendored Executable file → Normal file
View File

0
vendor/catfan/medoo/LICENSE vendored Executable file → Normal file
View File

0
vendor/catfan/medoo/README.md vendored Executable file → Normal file
View File

0
vendor/catfan/medoo/composer.json vendored Executable file → Normal file
View File

0
vendor/catfan/medoo/medoo.php vendored Executable file → Normal file
View File

0
vendor/catfan/medoo/src/medoo-logo.png vendored Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

0
vendor/composer/ClassLoader.php vendored Executable file → Normal file
View File

0
vendor/composer/LICENSE vendored Executable file → Normal file
View File

0
vendor/composer/autoload_classmap.php vendored Executable file → Normal file
View File

0
vendor/composer/autoload_files.php vendored Executable file → Normal file
View File

0
vendor/composer/autoload_namespaces.php vendored Executable file → Normal file
View File

0
vendor/composer/autoload_psr4.php vendored Executable file → Normal file
View File

0
vendor/composer/autoload_real.php vendored Executable file → Normal file
View File

0
vendor/composer/autoload_static.php vendored Executable file → Normal file
View File

0
vendor/composer/installed.json vendored Executable file → Normal file
View File