Code Monkey home page Code Monkey logo

idc-php's Introduction

idc-php

IDC PHP bindings

The IDpack Cloud PHP library provides convenient access to the IDC API from applications written in PHP. The API is available with an IDC Professional or IDC Enterprise plan.

Requirements

PHP 5.6.0 and later.

Not tested yet

  • PHP 8.x

Manual Setup

Include the idc.class.php file into your project and set it up like this:

require_once 'idc.class.php';
$idc = new IDpack('username', 'password', 'user_secret_key', 'project_secret_key');

or

require_once 'idc.class.php';
$idc = new IDpack();
$idc->setUsername('username');
$idc->setPassword('password');
$idc->setUserSecretKey('user_secret_key');
$idc->setProjectSecretKey('project_secret_key');

Code Examples

Grab a record from a project in a JSON format.

require_once 'idc.class.php';
$idc = new IDpack('username', 'password', 'user_secret_key', 'project_secret_key');
$response = $idc->get_record(['idc_id_number' => '10000']);
echo $response;

Response:

{
  "status": "success",
  "message": null,
  "code": 200,
  "data": {
    "record": {
      "idc_id_number": "10000",
      "idc_active": "1",
      "idc_trash": "0",
      "idc_colorcode": "6",
      "idc_firstname": "David",
      "idc_lastname": "Wilson",
      "idc_mobilephone": null,
      "idc_email": "[email protected]",
      "idc_member_id": "163567",
      "idc_expirationdate": "2025-01-22",
      "idc_insdate": "2023-01-23 06:53:55",
      "idc_moddate": "2023-01-23 14:53:16",
      "idc_picturedate": "2023-01-29 18:12:39",
      "idc_printdate": "2023-01-29 13:26:20"
    }
  },
  "api": {
    "api_action": "get_record", 
    "api_queries_remaining": 8345,
    "api_software": "IDpack Cloud",
    "api_version": "2.1.8",
    "api_request_date": "2023-01-29 19:30:12"
  }
}

Grab all records from a project in a JSON format.

$response = $idc->get_all_records();
echo $response;

Grab a jpeg Base64 Photo ID from a project record in a JSON format.

$response = $idc->get_photo_id(['idc_id_number' => '10000'], 'jpeg');
echo $response;

Grab a jpeg Base64 Badge Preview from a project record in a JSON format.

$response = $idc->get_badge_preview(['idc_id_number' => '10000'], 'jpeg');
echo $response;

Update a record from a project.

$response = $idc->update_record(['idc_id_number' => '10000'], ['idc_firstname' => 'Julie', 'idc_lastname' => 'Smith']);
echo $response;

Insert a record in a project.

$response = $idc->insert_record(['idc_colorcode' => 2, 'idc_firstname' => 'Mark', 'idc_lastname' => 'Morgan']);
echo $response;

//get the inserted primary key
$insert_id = $idc->getInsertID();

Activate a record in a project.

$response = $idc->set_record_active(['idc_id_number' => '10000']);
echo $response;

Desactivate a record in a project.

$response = $idc->set_record_not_active(['idc_id_number' => '10000']);
echo $response;

Delete a record in a project.

$response = $idc->delete_record(['idc_id_number' => '10000']);
echo $response;

idc-php's People

Contributors

martinbourdages avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.