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.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
LDAP.AddJSON
Adds an entry to a tree.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| LDAP JSON | 8.0 | Yes | Yes | Yes | Yes | No |
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
- Embrace JSON
- MBS FileMaker Plugin, version 10.3pr9
- MBS FileMaker Plugin, version 10.1pr6
- With JSON in excellent form
- MBS FileMaker Plugin, version 8.0pr9
- MBS FileMaker Plugin, version 7.6pr2
- LDAP with JSON
Release notes
- Version 10.3
- Added option to LDAP.AddJSON and LDAP.ModifyJSON to include boolean keys "hex" and "base64" in JSON with true value to pass values as hex/base64 string, which the plugin decodes and passes to LDAP server.
- Version 10.1
- Deprecated LDAP.Add, LDAP.AddList, LDAP.AddRecord in favor of LDAP.AddJSON.
- Fixed crash in LDAP.AddJSON with invalid data by improving error handling.
- Version 8.0
- Added JSON functions for LDAP: LDAP.AddJSON, LDAP.JSON and LDAP.ModifyJSON.
- Fixed parameter count error for LDAP.AddJSON.
Created 11st December 2017, last changed 11st July 2020
Feedback: Report problem or ask question.
Links
MBS Xojo Plugins