You are not logged in.
Pages: 1
Hi all,
Getting started with the Third Light API is a little easier if you have some example JSON to look at. Here are some simple cases that show the sort of arrangements of arrays and key/values that we use, which should clarify the API documentation (in the Help menu).
If you prefer to have Third Light do your API integration work as a consultancy project, just drop us a note at services@thirdlight.com!
Best wishes
Michael
Examples of JSON
Logging in and getting a session for the user "tlps"
Client:
{"action":"Core.Login","inParams": {"username":"tlps","password":"VNKL39j41sXc3V","apiVersion":"1.0"}}
Response:
{"result":{"api":"OK","action":"OK","timings":{"initTime":52,"setupTime":12,"methodTime":635,"totalTime":699}},"outParams":{"sessionId":"-Qqmhm1wvK5QrLIEpByyyujGBgJKh8VX","userDetails":{"type":1,"userref":"1-132142","username":"tlps","description":"Service Account","email":"info@example.com","canPublish":true}}}
Does the user "marco" exist?
Client:
{"apiVersion":"1.0", "sessionId":"-Qqmhm1wvK5QrLIEpByyyujGBgJKh8VX","action":"Users.DoesUserExist","inParams": {"username":"marco"}}
Response (true means yes):
{"result":{"api":"OK","action":"OK","timings":{"initTime":80,"setupTime":17,"methodTime":5,"totalTime":102}},"outParams":true}
Create a user "marco" in a specific group
The group ID is 339052, which can be easily found by viewing the group in Third Light and looking at the URI.
{"apiVersion":"1.0", "sessionId":"-Qqmhm1wvK5QrLIEpByyyujGBgJKh8VX","action":"Users.CreateUser","inParams": {"username":"marco","description":"Marco User","email":"marco@example.com","preset":"g:339052"}}
Response:
The user ID of the new user is 132320.
{"result":{"api":"OK","action":"OK","timings":{"initTime":54,"setupTime":9,"methodTime":1878,"totalTime":1941}},"outParams":{"id":132320}}
Create a folder under a specific folder ID, 41381228377
Client:
{"apiVersion":"1.0", "sessionId":"-Qqmhm1wvK5QrLIEpByyyujGBgJKh8VX","action":"Folders.CreateFolder","inParams": {"type":"FOLDER","folderName":"My folder","parentId":"41381228377"}}
Response (new Folder id is 41385057430):
{"result":{"api":"OK","action":"OK","timings":{"initTime":61,"setupTime":11,"methodTime":388,"totalTime":460}},"outParams":{"id":"41385057430","parentId":"41381228377","name":"My Folder","quota":"0","description":"","folderDate":"1490799523","folderType":"folder","createUnder":true,"subtreeQuota":0,"accessible":true,"hasChildContainers":false,"hasChildAssets":false}}
Set metadata on a folder (or a file) id 41385309904
Client:
{"apiVersion": "1.0", "sessionId": "-Qqmhm1wvK5QrLIEpByyyujGMgJKh8VX", "action": "metadata.SetMetaData", "inParams": {"itemId": "41385309904", "type": "FOLDER", "values": {"photographerName":[{"value":"Marco"}], "city":[{"value":"San Diego"}], "portfolioURL":[{"value":"https://google.com/me"}], "country":[{"value":"USA"}], "state":[{"value":"CA"}], "style":[{"value":"Fashion"},{"value":"Art"},{"value":"Commercial"},{"value":"Sports"}]} }}
If the asset ID is a file, just change type to FILE. Notice the "style" field is an example of a keyword metadata field, which accepts multiple values.
Response:
{"result":{"api":"OK","action":"OK","timings":{"initTime":68,"setupTime":10,"methodTime":252,"totalTime":330}},"outParams":{"photographerName":[{"value":"Marco","inherit":false,"override":false}],"city":[{"value":"San Diego","inherit":false,"override":false}],"portfolioURL":[{"value":"https:\/\/google.com\/me","inherit":false,"override":false}],"country":[{"value":"USA","inherit":false,"override":false}],"state":[{"value":"CA","inherit":false,"override":false}],"style":[{"value":"Fashion","inherit":false,"override":false},{"value":"Art","inherit":false,"override":false},{"value":"Commercial","inherit":false,"override":false},{"value":"Sports","inherit":false,"override":false}]}}
As you can see, one of the things to focus on is the structure of the JSON (e.g. how the arrays are used, or whether multiple values are expected). These examples cover the vast majority of cases you will find in the Third Light API.
Offline
Pages: 1