General - Contacts

Created: 2022-03-26 09:19:23 || Updated: 2022-09-11 06:18:03

Allow your clients to interact with the ITFlow portal by creating contacts.


You can record the following information about a contact:

  • Name
  • Title
  • Department
  • Phone / Extension / Mobile
  • Location
  • Email
  • Notes
  • Portal Auth method (local/SSO)



API

/api/v1/contacts

Read - Retrieve contact information (/read.php)

  • Default / No params - Returns all contacts
  • contact_id - Specific contact ID from the ITFlow database
  • contact_email - Specific contact via e-mail

Invoke-RestMethod -Uri "http://127.0.0.1/itflow/api/v1/contacts/read.php?api_key=XetQjoZiti5Opg7y&contact_id=8" | ConvertTo-Json

{
    "success":  "True",
    "count":  1,
    "data":  [
                 {
                     "0":  "8",
                     "contact_id":  "8",
                     "1":  "Sample Contact",
                     "contact_name":  "Sample Contact",
                     "2":  "Accounting Person",
                     "contact_title":  "Accounting Person",
                     "3":  "a@itflow.org",
                     "contact_email":  "a@itflow.org",

[...]


Create - Create a new contact (/create.php)

Specify all parameters as below, even if empty. E-mail must not already exist. The new contact ID will be returned.

$uri = "http://127.0.0.1/itflow/api/v1/contacts/create.php"

$body = @"
{
    "api_key" : "3iVeTipINS9eDGpm",
    "contact_name" : "Sample Contact",
    "contact_title" : "Accounting Director",
    "contact_department" : "Accounting Dept",
    "contact_phone" : "123456",
    "contact_extension" : "22",
    "contact_mobile" : "",
    "contact_email" : "a@itflow.org",
    "contact_notes" : "Nice person",
    "contact_auth_method" : "local",
    "contact_location_id" : "",
    "client_id" : "1"
}
"@

Invoke-RestMethod -Method Post -Uri $uri -Body $body


success count data            
------- ----- ----            
True    1     {@{insert_id=9}}


Update - Update an new contact (/update.php)

Specify all parameters as below, even if empty. Same parameters as create endpoint, just additionally specify the contact_id to update.
Success (true/false) and count of affected objects (1) will be returned.

$uri = "http://127.0.0.1/itflow/api/v1/contacts/update.php"

$body = @"
{
    "api_key" : "3iVeTipINS9eDGpm",
    "contact_id" : "31",
    "contact_name" : "Sample Contact",
    "contact_title" : "Accounting Person",
    "contact_department" : "",
    "contact_phone" : "",
    "contact_extension" : "",
    "contact_mobile" : "",
    "contact_email" : "a@itflow.org",
    "contact_notes" : "",
    "contact_auth_method" : "local",
    "contact_location_id" : "",
    "client_id" : "1"
}
"@

Invoke-RestMethod -Method Post -Uri $uri -Body $body


success count
------- -----
True        1