Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 9.2   9.3   9.4   9.5   10.0   10.1   10.2   10.3   10.4   10.5    Statistic    FMM    Blog  

LDAP.AddJSON

Adds an entry to a tree.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
LDAP JSON 8.0 Yes Yes Yes Yes No
MBS( "LDAP.AddJSON"; LDAPRef; dn; JSON )   More

Parameters

Parameter Description Example
LDAPRef The reference number for the LDAP connection. $ldap
dn The name of the entry to add.
JSON The JSON to parse.
Must be a JSON array with entries. Each entry has an element operation with Add, Replace, Delete or Increment. Also a node with name "type" and the type to set. Than you can pass with value a single value or with values a list of values.

Result

Returns OK or error.

Description

Adds an entry to a tree.
The parent of the entry being added must already exist or the parent must be empty (equal to the root distinguished name) for an add operation to succeed.

Sample JSON for structure:

[{
    "operation": "Add",
    "type": "xxx",
    "values": ["Hello", "World"]
},
{
    "operation": "Add",
    "type": "yyy",
    "base64": true,
    "value": "SGVsbG8gV29ybGQ="
},
{
    "operation": "Add",
    "type": "zzz",
    "hex": true,
    "value": "48656C6C6F20576F726C64"
}]

Type is the name of the attribute, e.g. cn.
Version 10.1 or newer accepts name instead of type for the key to match the search results.

Version 10.3 adds new boolean fields "hex" and "base64". If true, we decode value from hex/base64 encoding and pass them as binary values.

Examples

Add a new employee to LDAP:

Set Variable [ $ldap ; Value: MBS("LDAP.Connect"; "ldap.test.de"; 0; 389 ) ]
Set Variable [ $r ; Value: MBS("LDAP.Bind"; $ldap; "cn=admin,dc=ldap,dc=test,dc=de"; "S2A2S@home"; "simple" ) ]
Set Variable [ $r ; Value: MBS("LDAP.AddJSON"; $ldap; Employee::_LDAP.Entry.CN; Employee::_LDAP.JSON.Add) ]
Set Variable [ $r ; Value: MBS("LDAP.Release"; $ldap) ]

Example result:
Input JSON used:
[
  {
    "operation":   "Add",
    "name":   "objectClass",
    "values":   [
      "posixAccount",
      "shadowAccount",
      "top",
      "inetOrgPerson",
      "organizationalPerson",
      "person"
    ]
  },
  {
    "operation":   "Add",
    "name":   "uid",
    "value":   "bob.miller"
  },
  {
    "operation":   "Add",
    "name":   "uidNumber",
    "value":   "1"
  },
  {
    "operation":   "Add",
    "name":   "cn",
    "value":   "Bob Miller"
  },
  {
    "operation":   "Add",
    "name":   "mail",
    "value":   "bob.miller@test.de"
  },
  {
    "operation":   "Add",
    "name":   "homeDirectory",
    "value":   "/usr/local/var/"
  },
  {
    "operation":   "Add",
    "name":   "sn",
    "value":   "Miller"
  },
  {
    "operation":   "Add",
    "name":   "employeeType",
    "value":   "Employee"
  },
  {
    "operation":   "Add",
    "name":   "givenName",
    "value":   "Bob"
  },
  {
    "operation":   "Add",
    "name":   "employeeNumber",
    "value":   "77"
  },
  {
    "operation":   "Add",
    "name":   "userPassword",
    "value":   "xxxx"
  },
  {
    "operation":   "Add",
    "name":   "gidNumber",
    "value":   "100"
  }
]

See also

Blog Entries

Release notes

Created 11st December 2017, last changed 11st July 2020


LDAP.Add   -   LDAP.AddList

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins