
<p>Public API v1.0 Documentation</p><p>Draft: October 22, 2014 Contents Introduction</p><p>APIs in Trimble Connect allows one to read, write and update data into/out of the Connect platform. Now, one can create folders, upload/download files, modify views and do much more from within an application using Trimble Connect’s powerful API.</p><p>This document has two sections: A. Public Server APIs (Token based) B. Public 3D Viewer APIs (Token based)</p><p>Section A Public Server APIs are token based REST APIs that can be used from any client and can be exposed to the outside world or be used for systems integration/Apps etc.</p><p>Section B Public Viewer APIs are token based JavaScript APIs can be used to manipulate the viewer which can be embedded into any other web based application.</p><p>How to get your API Key</p><p>API key is used to generate access token to access all the Trimble Connect APIs. This key is based on your account email and does not change or expire. To generate this key you must first sign in to Trimble Connect. Another option for authentication is to use cookie based sync login API rather than logging in directly to Trimble Connect.</p><p>Use your credentials or signup for a new account: https://app.prod.gteam.com/gteam/app</p><p>After signing in, copy this URL in the same browser address bar you signed in and get your API Key</p><p>URL</p><p>GET https://app.prod.gteam.com/gteam/app/useraccounts/me/apikey </p><p>EXAMPLE RESPONSE</p><p>1. { 2. "key": "lpv5XiiJnD1XaCPvFW1QIU4tZFd1akpOUVhBOlFRckxtsk9qUm9Z" 3. } </p><p>Date format The date value used in the APIs is expressed as Unix epoch timestamp. All dates are in UTC.</p><p>EXAMPLE: 1410412870000</p><p>Authentication To use the public APIs, you will need to add the “Authorization” header to your requests.</p><p>Authorization Bearer access_token</p><p>Replace “access_token” with the value you get from the /auth API request explained below</p><p>POD Specific domain urls</p><p>Use the “origin” field value from the /regions API to determine the host URL for the API calls for specific POD of the project.</p><p>Exceptions</p><p>The APIs return JSON responses for most of the APIs on success. In case of exceptions, a JSON object is returned with error code and a message with HTTP status 409.</p><p>EXAMPLE RESPONSE </p><p>HTTP 409 Conflict</p><p>1. { 2. "message": "INVALID_SESSION", 3. "errorcode": "INVALID_SESSION" 4. } </p><p>Notes</p><p>- Unless specified, all input parameters mentioned in the APIs are required APIs</p><p>Authentication</p><p>Access Token Based Using the API key, you can generate an access token to be used for authentication in all other APIs. The access token is valid for 8 hours.</p><p>URL</p><p>POST https://app.prod.gteam.com/gteam/app/1.0/auth</p><p>REQUEST BODY ATTRIBUTES emailAddress string Login email address key string API Key</p><p>RESPONSE ATTRIBUTES token string Authentication Token</p><p>EXAMPLE REQUEST BODY</p><p>1. { 2. "emailAddress": "[email protected]", 3. "key" : "wJVOlWAgR5ZncCZBOTTN6kR5Znc0ODFmRTlVOlFRckxtak9qUm9Z" 4. } </p><p>EXAMPLE SUCCESS RESPONSE</p><p>HTTP 200 OK</p><p>1. { 2. "token": "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0MTE2MjYyMDksInN1YiI6IlFRckxtak9qUm9ZIiwidX NlcklkIjoiTS1kV3VqSk5RWEEiLCJpc3MiOiInYXBpLmd0ZWFtLmNvbSciLCJqdGkiOiJEeWZ3NDgxZkU5VSIs InNJZCI6IlVOSUpISjh4VXpBIiwiaWF0IjoxNDExNTk3NDA5fQ.roDQ7ingV4egNPNktyFye11RL9h- LXtiRwqJfFv-ztk" 3. } Cookie based Use this API to simulate cookie based login, which can be used with all further API calls and in this case you do not need API key.</p><p>URL</p><p>POST https://app.prod.gteam.com/gteam/app/sync/login/password_based</p><p>REQUEST BODY ATTRIBUTES emailAddress string Login email address password string User password</p><p>EXAMPLE REQUEST BODY</p><p>1. { 2. "emailAddress": "[email protected]", 3. "password" : "xxxxxxxx" 4. } </p><p>EXAMPLE SUCCESS RESPONSE</p><p>HTTP 200 OK with cookies Project</p><p>List of Project Locations</p><p>Returns list of project locations. The “origin” value is used to determine the base URL for subsequent APIs. This is called on the master pod.</p><p>URL</p><p>GET https://app.prod.gteam.com/gteam/app/1.0/regions</p><p>RESPONSE ATTRIBUTES pod integer Pod Id isMaster boolean Boolean to indicate if the pod is the master pod origin string Base URL to access the pod (Add protocol to the value) location string Pod location</p><p>EXAMPLE SUCCESS RESPONSE</p><p>1. [ 2. { 3. "podId": "Dyfw481fE9U", 4. "isMaster": true, 5. "origin": "//app.prod.gteam.com", 6. "location": "northAmerica" 7. }, 8. { 9. "podId": "pNCBBwArq-g", 10. "isMaster": false, 11. "origin": "//app.prod.gteam.com", 12. "location": "europe" 13. } 14. ] </p><p>List of Projects Returns a list of projects from the project location (defined by “origin”)</p><p>URL</p><p>GET https:<origin>/gteam/app/1.0/projects RESPONSE ATTRIBUTES</p><p>Id string Project Identifier</p><p>Name string Project name rootId string Root folder Identifier for the project</p><p>Image string Project image URL</p><p>Location string Project location lastVisited date Timestamp of last visit by the user making the request</p><p>Modified date Timestamp of last modification by any user</p><p>Created date Timestamp when the project was created createdBy object User that created the project</p><p>Size string Total project size noOfFiles integer Total number of files in project noOfVersions integer Total number of versions across all files/folders in the project noOfUsers integer Total number of users in the project</p><p>EXAMPLE SUCCESS RESPONSE</p><p>1. [ 2. { 3. "id": "M-dWujJNQXA", 4. "name": "Demo project", 5. "rootId": "tadQfUkLbrU", 6. "image": "/gteam/static/img/icons/no_projects_light_110.png", 7. "location": “northAmerica”, 8. "lastVisited": 1410412870000, 9. "modified": 1396485986000, 10. "created": 1396485986000, 11. "createdBy": { 12. "id": "M-dWujJNQXA", 13. "name": "imti gt-global s", 14. "email": "[email protected]" 15. }, 16. "size": "10.38 MB", 17. "noOfFiles": 5, 18. "noOfVersions": 5, 19. "noOfUsers": 2 20. } 21. ] Get Project Info URL</p><p>GET https:<origin>/gteam/app/1.0/projects/<projectId>?fullyLoaded=<fullyLoaded></p><p>PATH PARAMETERS projectId string Project Identifier </p><p>QUERY PARAMETERS</p><p>Boolean to fetch additional details [size, noOfFiles, fullyLoaded boolean Optional noOfVersions, noOfUsers]</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Project content API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Project content API]</p><p>Create Projects URL</p><p>GET https:<origin>/gteam/app/1.0/projects</p><p>REQUEST BODY ATTRIBUTES name string Project name </p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Project content API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Project content API] Folder</p><p>Folder contents Returns a list of folders and files in a given folder</p><p>URL</p><p>GET https:<origin>/gteam/app/1.0/folders/<folderId>/children?projectId=<projectId></p><p>PATH PARAMETERS folderId string Folder identifier to fetch children for</p><p>QUERY PARAMETERS projectId string Project identifier </p><p>RESPONSE ATTRIBUTES id string Folder Identifier versionId string Version identifier name string Folder name projectId string Project identifier parentVersionId string Parent folder version identifier parentId string Parent folder identifier hasChildren boolean Boolean value indicating if folder is empty type string Type of object (Valid values are [‘FILE’, ‘FOLDER’]) modified date Timestamp of last modification by any user modifiedBy object User that last modified the folder createdOn date Folder creation timestamp createdBy object User that created the project size string Folder size thumbnailUrl string Image URL</p><p>EXAMPLE SUCCESS RESPONSE</p><p>1. [ 2. { 3. "id": "3cIuFv8lfic", 4. "versionId": "3cIuFv8lfic", 5. "name": "Documents", 6. "projectId": "upZz8FMYa6k", 7. "parentVersionId": "xrHjrY6muOc", 8. "parentId": "xrHjrY6muOc", 9. "hasChildren": true, 10. "type": "FOLDER", 11. "modified": 1401231929000, 12. "modifiedBy": { 13. "id": "W1G1WjZPULI", 14. "name": "Karthik R", 15. "email": "[email protected]" 16. }, 17. "createdBy": { 18. "id": "W1G1WjZPULI", 19. "name": "Karthik R", 20. "email": "[email protected]" 21. }, 22. "createdOn": 1401231929000, 23. "size": "3.31 MB", 24. "thumbnailUrl": [ 25. "/gteam/static/img/icons/folder_60.png" 26. ] 27. } 28. ] </p><p>Folder contents by path Returns a list of folders and files in a given folder</p><p>URL</p><p>GET https:<origin>/gteam/app/1.0/folders/by_path?projectId=<projectId>&path=<path></p><p>QUERY PARAMETERS path string Folder path, starting with root folder (Ex: /samples/3dfiles) projectId string Project identifier </p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Folder content API] Create Folder URL</p><p>POST https:<origin>/gteam/app/1.0/folders</p><p>REQUEST BODY ATTRIBUTES name string Folder name parentId string Parent folder identifier projectId string Project Identifier</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Folder content API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Folder content API]</p><p>Get Folder Details Fetch details of the specified versionId</p><p>URL</p><p>GET https:<origin>/gteam/app/1.0/folders/<versionId>?projectId=<projectId></p><p>PATH PARAMETERS versionId string Folder identifier </p><p>QUERY PARAMETERS projectId string Project Identifier</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Folder content API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Folder content API] Get Folder versions Fetch all versions of the specified versionId</p><p>URL</p><p>GET https:<origin>/gteam/app/1.0/folders/<versionId>/versions?projectId=<projectId></p><p>PATH PARAMETERS versionId string Folder Identifier </p><p>QUERY PARAMETERS projectId string Project Identifier</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Folder content API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Folder content API]</p><p>Rename Folder Rename a folder given the latest versionId</p><p>URL</p><p>POST https:<origin>/gteam/app/1.0/folders/rename</p><p>REQUEST BODY ATTRIBUTES name string Folder name id string Folder identifier versionId string Version identifier projectId string Project Identifier</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Folder content API]</p><p>EXAMPLE SUCCESS RESPONSE See here [Response Attributes for Folder content API]</p><p>POSSIBLE RESPONSE CODES</p><p>INVALID_OPERATION_OLD_REVISIO If versionId specified is not latest versionId N</p><p>Delete Folder URL</p><p>DELETE https:<origin>/gteam/app/1.0/folders/<folderId></p><p>PATH PARAMETERS folderId string Folder Identifier</p><p>EXAMPLE SUCCESS RESPONSE </p><p>HTTP 204 No Content</p><p>File</p><p>Upload File URL</p><p>POST https:<origin>/gteam/app/1.0/files?parentId=<parentId>&projectId=<projectId></p><p>QUERY PARAMETERS projectId string Project identifier parentId string Parent folder identifier</p><p>REQUEST BODY ATTRIBUTES filename string File name </p><p>This is a multi-part request body, add the following header Content-Type multipart/form-data</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Folder content API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Folder content API]</p><p>Get File Details Fetch details of the specified versionId</p><p>URL</p><p>GET https:<origin>/gteam/app/1.0/files/<versionId>?projectId=<projectId></p><p>PATH PARAMETERS versionId string File identifier </p><p>QUERY PARAMETERS projectId string Project Identifier</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Folder content API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Folder content API]</p><p>Get File versions Fetch details of the specified versionId</p><p>URL</p><p>GET https:<origin>/gteam/app/1.0/files/<versionId>/versions?projectId=<projectId></p><p>PATH PARAMETERS versionId string File identifier to fetch versions for QUERY PARAMETERS projectId string Project Identifier</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Folder content API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Folder content API]</p><p>Download File URL</p><p>GET https:<origin>/gteam/app/1.0/files?versionId=<versionId>&projectId=<projectId></p><p>QUERY PARAMETERS projectId string Project identifier versionId string Version identifier </p><p>This returns a stream for the file, add the following header to the request</p><p>Content-Type application/octet-stream</p><p>RESPONSE</p><p>HTTP 200 OK</p><p>Checkout Files URL</p><p>POST https:<origin>/gteam/app/1.0/files/checkout</p><p>REQUEST BODY ATTRIBUTES</p><p>Array of ids of files/folders to checkout</p><p>In case of folder ids, the API will recursively checkout files under that folder EXAMPLE REQUEST BODY</p><p>1. ["pT06-8_AzZE","LcJWPwE3YI4"] </p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for File content API]</p><p>POSSIBLE RESPONSE CODES</p><p>FILE_ALREADY_CHECKED_OUT If file is already checked out by same user</p><p>FILE_CHECKED_OUT_BY_ANOTHER_USER If file is already checked out by another user</p><p>Checkin Files URL</p><p>POST https:<origin>/gteam/app/1.0/files/checkin</p><p>REQUEST BODY ATTRIBUTES</p><p>Array of ids of files/folders to check-in</p><p>In case of folder ids, the API will recursively check-in files under that folder</p><p>EXAMPLE REQUEST BODY</p><p>1. ["pT06-8_AzZE","LcJWPwE3YI4"] </p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for File content API]</p><p>POSSIBLE RESPONSE CODES</p><p>FILE_NOT_CHECKED_OU If file is not checked out T</p><p>Rename File Rename a file given the latest versionId</p><p>URL POST https:<origin>/gteam/app/1.0/files/rename</p><p>REQUEST BODY ATTRIBUTES name string New name id string File identifier versionId string Version Identifier projectId string Project Identifier</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Folder content API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Folder content API]</p><p>POSSIBLE RESPONSE CODES</p><p>INVALID_OPERATION_OLD_REVISIO If versionId specified is not latest versionId N</p><p>Delete File Delete the file for the specified versionId</p><p>URL</p><p>DELETE https:<origin>/gteam/app/1.0/files/<versionId>?projectId=<projectId></p><p>PATH PARAMETERS versionId string Version identifier </p><p>QUERY PARAMETERS projectId string Project identifier </p><p>RESPONSE </p><p>HTTP 204 No Content</p><p>ToDo</p><p>List of ToDos URL</p><p>GET https:<origin>/gteam/app/1.0/todos?projectId=<projectId></p><p>QUERY PARAMETERS projectId string Project identifier </p><p>RESPONSE ATTRIBUTES id string Todo Identifier label string User friendly identifier description string Description dueDate date Due date objectStatusDto object Object to represent Todo status (details below) priorityDto object Object to represent Todo priority (details below) modified date Last modification timestamp modifiedBy object User that modified the Todo created date Todo creation timestamp createdBy object User that created the Todo projectId string Project Identifier </p><p>NESTED OBJECT DETAILS objectStatusDto – id string Status label Identifier Status value - Valid options are ["NEW", "IN_PROGRESS", label string "RESOLVED", "BLOCKED", "CLOSED"] sequence integer Sort order (read-only) priorityDto – id string Status label Identifier Status value - Valid options are ["LOW", "NORMAL ", "HIGH", label string "CRITICAL"] sequence integer Sort order (read-only)</p><p>EXAMPLE REQUEST BODY</p><p>1. [ 2. { 3. "id": "pKvW7zKEIRk", 4. "label": "DEMO-23", 5. "description": "missing column", 6. "dueDate": null, 7. "objectStatusDto": { 8. "id": "Dyfw481fE9U", 9. "label": "NEW", 10. "sequence": 1 11. }, 12. "priorityDto": { 13. "id": "3UUWLWca4SQ", 14. "label": "HIGH", 15. "sequence": 6 16. }, 17. "projectId": "upZz8FMYa6k", 18. "createdBy": { 19. "id": "M-dWujJNQXA", 20. "name": "imti gt-global s", 21. "email": "[email protected]" 22. }, 23. "modifiedBy": { 24. "id": "M-dWujJNQXA", 25. "name": "imti gt-global s", 26. "email": "[email protected]" 27. }, 28. "created": 1411582930000, 29. "modified": 1411582930000 30. } 31. ]</p><p>Create ToDo URL</p><p>POST https:<origin>/gteam/app/1.0/todos REQUEST BODY ATTRIBUTES description string Description projectId string Project Identifier</p><p>OPTIONAL REQUEST BODY ATTRIBUTES dueDate date Due date [Example Format: 2014-10-29T07:00:00.000Z] priorityDto object Object to represent Todo priority</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Todo Listing API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Todo Listing API]</p><p>Comment</p><p>List of Comments URL</p><p> https:<origin>/gteam/app/1.0/comments? GET projectId=<projectId>&objectId=<objectId>&objectType=<objectType></p><p>QUERY PARAMETERS projectId string Project identifier </p><p>Object identifier [VersionId of File/Folder or ToDo Id, depending on objectId string object type] objectType string Object type – Valid options are ["FILE", "FOLDER ", "TODO"]</p><p>RESPONSE ATTRIBUTES id string Comment Identifier objectId string Object Identifier [VersionId of File/Folder or ToDo Id, depending on object type] objectType string Object type – Valid options are ["FILE", "FOLDER ", "TODO"] description string Description modified date Last modification timestamp modifiedBy object User that modified the Comment created date Comment creation timestamp createdBy object User that created the Comment</p><p>EXAMPLE REQUEST BODY</p><p>1. [ 2. { 3. "id": "qiZymj5TbzY", 4. "description": "Image missing on page 3", 5. "createdBy": { 6. "id": "eX9gwJqSe8I", 7. "name": "Imtiyaz S", 8. "email": "[email protected]" 9. }, 10. "created": 1413846301000, 11. "objectId": "jzdQBWZ1q5U", 12. "objectType": "FOLDER" 13. }, 14. { 15. "id": "IaFXVwzc3Dk", 16. "description": "Good find.", 17. "createdBy": { 18. "id": "eX9gwJqSe8I", 19. "name": "Imtiyaz S", 20. "email": "[email protected]" 21. }, 22. "created": 1413846298000, 23. "objectId": "jzdQBWZ1q5U", 24. "objectType": "FOLDER" 25. } 26. ] POSSIBLE RESPONSE CODES</p><p>OBJECT_NOT_FOUND If object of “objectType” specified in request is not found If object of “objectType” specified in request does not belong OBJECT_NOT_IN_PROJECT to specified project</p><p>UNSUPPORTED_TYPE If “objectType” is not supported Create Comment URL</p><p>POST https:<origin>/gteam/app/1.0/comments</p><p>REQUEST BODY ATTRIBUTES description String Description Object Identifier [VersionId of File/Folder or ToDo Id, depending on objectId String object type] objectType String Object type – Valid options are ["FILE", "FOLDER ", "TODO"] projectId String Project Identifier</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Comments Listing API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Comments Listing API]</p><p>Edit Comment URL</p><p>PATCH https:<origin>/gteam/app/1.0/comments</p><p>REQUEST BODY ATTRIBUTES description string Description id string Comment Identifier projectId string Project Identifier</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Comments Listing API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Comments Listing API]</p><p>Delete Comment URL DELETE https:<origin>/gteam/app/1.0/comments/<commentId></p><p>PATH PARAMETERS commentId string Comment Identifier </p><p>RESPONSE </p><p>HTTP 204 No Content</p><p>Release</p><p>List of Releases URL</p><p>GET https:<origin>/gteam/app/1.0/releases?status=<releaseStatus>&projectId=<projectId></p><p>QUERY PARAMETERS projectId string Project Identifier Required</p><p>Release status - Valid options are ["OPEN", "SENT", string Optional status "RECEIVED"]. If excluded, will return all statuses</p><p>RESPONSE ATTRIBUTES id string Release Identifier name string Release name Status value - Valid options are ["OPEN", "SENT", status string "RECEIVED"] projectId string Project identifier notes string Release notes dueDate date Release due date recipients array List of user objects createdBy object User that created the release created date Release creation timestamp modifiedBy object User that modified the release modified date Release modification timestamp</p><p>Get Releases details URL</p><p>GET https:<origin>/gteam/app/1.0/releases/<releaseId>?projectId=<projectId></p><p>PATH PARAMETERS releaseId string Release Identifier projectId string Project Identifier</p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for Releases Listing API]</p><p>EXAMPLE SUCCESS RESPONSE</p><p>See here [Response Attributes for Releases Listing API]</p><p>List of Release Files Returns list of files included in the release</p><p>URL</p><p>GET https:<origin>/gteam/app/1.0/releases/files?projectId=<projectId>&releaseId=<releaseId></p><p>QUERY PARAMETERS projectId string Project Identifier releaseId string Release Identifier </p><p>RESPONSE ATTRIBUTES</p><p>See here [Response Attributes for File content API]</p><p>EXAMPLE SUCCESS RESPONSE See here [Response Attributes for File content API]</p><p>Model</p><p>Get Model Alignment Get the alignment for the specified versionId</p><p>URL</p><p>GET https:<origin>/gteam/app/1.0/ model/align/<versionId></p><p>PATH PARAMETERS versionId string File identifier </p><p>RESPONSE ATTRIBUTES id string Model offset id. Array of matrix Row major 4x4 transformation matrix. double</p><p>Model unit is mm.</p><p>EXAMPLE RESPONSE BODY</p><p>1. { 2. "id": "Skd-09NiKrg", 3. "matrix": [ 4. 0.999999, 5. -0.000781397, 6. 0.00117874, 7. 25.4, 8. 0.000999999, 9. 0.980066, 10. -0.198668, 11. 50.8, 12. -0.001, 13. 0.198669, 14. 0.980066, 15. 101.6, 16. 0, 17. 0, 18. 0, 19. 1 20. ] 21. } </p><p>Set Model Alignment Set the alignment for the specified versionId</p><p>URL</p><p>POST https:<origin>/gteam/app/1.0/model/align/<versionId></p><p>PATH PARAMETERS versionId String File identifier </p><p>RESPONSE ATTRIBUTES id String Model offset id.</p><p>Array of matrix Row major 4x4 transformation matrix. double</p><p>Model unit is mm.</p><p>EXAMPLE REQUEST BODY</p><p>1. { 2. "matrix": [ 3. 0.999999, 4. -0.000781397, 5. 0.00117874, 6. 25.4, 7. 0.000999999, 8. 0.980066, 9. -0.198668, 10. 50.8, 11. -0.001, 12. 0.198669, 13. 0.980066, 14. 101.6, 15. 0, 16. 0, 17. 0, 18. 1 19. ] 20. } EXAMPLE RESPONSE BODY</p><p>1. { 2. "id": "Skd-09NiKrg", 3. "matrix": [ 4. 0.999999, 5. -0.000781397, 6. 0.00117874, 7. 25.4, 8. 0.000999999, 9. 0.980066, 10. -0.198668, 11. 50.8, 12. -0.001, 13. 0.198669, 14. 0.980066, 15. 101.6, 16. 0, 17. 0, 18. 0, 19. 1 20. ] 21. } B. Public 3D Viewer APIs (Token based) Public Viewer APIs are token based JavaScript APIs can be used to manipulate the viewer which can be embedded into any other web based application.</p><p>1. Prerequisites: SSL Server Setup</p><p>Enabling SSL on Apache [SSL is required for Trimble Connect API use]</p><p>This tutorial uses XAMPP version 3.2.x</p><p>1.a.1. Install XAMPP Server</p><p>XAMPP URL: https://www.apachefriends.org/index.html</p><p>1.a.2. Open the following file in a plain text editor such as notepad or gedit [not Excel]:</p><p>C:\xampp\apache\makecert.bat</p><p>1.a.3. Change the second line in the file from: set OPENSSL_CONF=./bin/openssl.cnf to: set OPENSSL_CONF=./conf/openssl.cnf</p><p>1.a.4. Open the windows command prompt [or the terminal if using OSX or GNU Linux]</p><p>1.a.5. In the command prompt, point to the Apache installation folder by entering the following command: cd C:\xampp\apache</p><p>1.a.6. Create a new SSL certificate by entering the following command: makecert</p><p>* Enter values when prompted.</p><p>* The 'Common Name' should be the domain name or IP address of the XAMPP server.</p><p>* For local testing, 'localhost' can be entered.</p><p>* The 'challenge password' is an optional entry that can be left blank if preferred.</p><p>1.a.7. Enter the following text into the file 'C:\xampp\apache\conf\extra\httpd-xampp.conf' at the top line:</p><p><IfModule mod_rewrite.c></p><p>RewriteEngine On</p><p># Redirect -xampp folder to https</p><p>RewriteCond %{HTTPS} !=on</p><p>RewriteCond %{REQUEST_URI} xampp</p><p>RewriteRule ^(.*) https:--%{SERVER_NAME}$1 [R,L]</p><p># Redirect -phpMyAdmin folder to https</p><p>RewriteCond %{HTTPS} !=on</p><p>RewriteCond %{REQUEST_URI} phpmyadmin</p><p>RewriteRule ^(.*) https:--%{SERVER_NAME}$1 [R,L]</p><p># Redirect -security folder to https</p><p>RewriteCond %{HTTPS} !=on RewriteCond %{REQUEST_URI} security</p><p>RewriteRule ^(.*) https:--%{SERVER_NAME}$1 [R,L]</p><p># Redirect -webalizer folder to https</p><p>RewriteCond %{HTTPS} !=on</p><p>RewriteCond %{REQUEST_URI} webalizer</p><p>RewriteRule ^(.*) https:--%{SERVER_NAME}$1 [R,L]</p><p></IfModule></p><p>1.a.8. In the file 'C:\xampp\apache\conf\httpd.conf,' search for the text 'LoadModule rewrite_module modules/mod_rewrite.so' and check that there is no pound # sign in front of it.</p><p>The line should read: LoadModule rewrite_module modules/mod_rewrite.so and not: #LoadModule rewrite_module modules/mod_rewrite.so</p><p>1.a.9. Go to the Windows start menu and search for 'certmgr.msc'</p><p>1.a.10. In the CertMgr menu, click on 'Trusted Root Certification Authorities'</p><p>1.a.11. Right-click on 'Certificates' listed in the 'Object Type' list, and select 'All Tasks > Import'</p><p>1.a.12. Browser to the folder 'C:\xampp\apache\conf\ssl.crt,' select the file 'server.crt,' and click 'open'.</p><p>1.a.13. Accept default settings when clicking through the file import menu.</p><p>1.a.14. Close the CertMgr tool [Click File > Exit]</p><p>1.a.15. Start XAMPP server and click 'Start' in the Actions list next to 'Apache'</p><p>1.a.16. Check https://localhost/ in a web browser to verify that SSL is set up.</p><p>2. Authentication</p><p>2.a. Log into Trimble Connect.</p><p>2.b. Go to https://app.prod.gteam.com/gteam/app/useraccounts/me/apikey to retrieve your API key.</p><p>2.c. Retrieve an access token to use when making API calls.</p><p>Access tokens can be retrieved by sending a post request to the URL: https://app.prod.gteam.com/gteam/app/1.0/auth</p><p>The following PHP sample code performs a POST request to retrieve an API key.</p><p>$url = https://app.prod.gteam.com/gteam/app/1.0/auth";</p><p>$data = array(</p><p>'emailAddress' => "[email protected]",</p><p>'key' => "Z-hf79kjhty79Hhfj84Dhy3HJYyf6580kHTR6gu8"</p><p>);</p><p>$options = array(</p><p>'http' => array(</p><p>'method' => 'POST',</p><p>'content' => json_encode( $data ),</p><p>'header'=> "Content-Type: application/json\r\n" . "Accept: application/json\r\n"</p><p>)</p><p>);</p><p>$context = stream_context_create( $options );</p><p>$result = file_get_contents( $url, false, $context );</p><p>$response = json_decode( $result );</p><p> echo $response->token;</p><p>The access token will look similar to the following string: eyJhbGciOiJIUzI1NiJ9.eyJhfi6YHITYsInN1YiI6IlFRckxtak9qUm9ZIiwid</p><p>XNlcklkIjoiZUJBdzA3NEIyVmciLCJpc3MiOiInYXBpLmd0ZWFtLmNvb</p><p>SciLCJqdGkiOiJxMkk3ZHdEV3JuTSIsInNJZCI6IkhONDhkX2FxVmtN</p><p>IiwiaWF0IjoxNDA2NzY3Mzk2fQ.DgxYhi8f4TVviykDBBVQ</p><p>The PHP code above, placed within a php file, should be called to retrieve an access token before proceeding to step 3 below.</p><p>The php file can be called with an ajax post, or other method.</p><p>See Appendix item 5.b for sample code.</p><p>3. Instantiating the Embedded Viewer</p><p>3.a. Include the following javascript file: https://app.prod.gteam.com/gteam/static/gteam/viewer/embed.js</p><p>3.b. Specify a DOM node to embed the Trimble Connect viewer. var ViewerNode = document.getElementById("GTeamViewer");</p><p>3.c. Specify the embedded viewer's configuration.</p><p>This can be done by using a javascript array as described below:</p><p> var viewer_data = { "domNode": node</p><p>, "title": "Viewer Title to Display on Web Page"</p><p>, "noProperties": false</p><p>, "noLeft": false</p><p>, "debug": true</p><p>, "height": 850</p><p>, "width": 1500</p><p>, "gteamOrigin" : encodeURIComponent("https://app.prod.gteam.com")</p><p>, "projId" : "Dyfw481fE9U"</p><p>, "objects" : "M-dWujJNQXA"</p><p>, "mashup" : "Dyfw481fE9U"</p><p>, "accessToken" : accessTokenString</p><p>, "class" : "embeddedViewFrame"</p><p>, "onInitialized": function() { optional: place code here } //callback function to run code on viewer load };</p><p>See Appendix item 5.a for embedded viewer parameter definitions.</p><p>3.c.2. Retrieving the Project ID</p><p>Log into Trimble Connect, and within the project display the file within the Trimble Connect viewer.</p><p>The extract the Project ID from the page URL https://app.prod.gteam.com/gteam/app/#project,viewer&id=BYRvifmFaUk&mashup=3d9LXbVDCqs&o bjects=X6Uw9Wd7kz8 project,viewer&id=BYRvifmFaUk</p><p>BYRvifmFaUk</p><p>3.c.3. Retrieving the Objects ID https://app.prod.gteam.com/gteam/app/#project,viewer&id=BYRvifmFaUk&mashup=3d9LXbVDCqs&o bjects=X6Uw9Wd7kz8 objects=X6Uw9Wd7kz8</p><p>X6Uw9Wd7kz8</p><p>3.c.4. Retrieving the Mashup ID https://app.prod.gteam.com/gteam/app/#project,viewer&id=BYRvifmFaUk&mashup=3d9LXbVDCqs&o bjects=X6Uw9Wd7kz8 mashup=3d9LXbVDCqs</p><p>3d9LXbVDCqs</p><p>3.d. Create an instance of the Trimble Connect embedded viewer var viewer = new EmbeddedViewer(viewer_data);</p><p>Full example for embed viewer <html></p><p><head></p><p><title>Trimble Connect</title></p><p></head></p><p><body></p><p><div id="TrimbleConnectViewer"></div></p><p><script type="text/javascript" src="https://app.prod.gteam.com/gteam/static/gteam/viewer/embed.js"></script></p><p><script></p><p> var ViewerNode = document.getElementById("TrimbleConnectViewer ");</p><p> var viewer_data = { "domNode": ViewerNode</p><p>, "title": "Trimble Connect Embedded Viewer"</p><p>, "noProperties": false</p><p>, "noLeft": true</p><p>, "debug": true</p><p>, "height": 850</p><p>, "width": 1500</p><p>, "gteamOrigin" : encodeURIComponent("https://app.prod.gteam.com")</p><p>, "projId" : "ProjectId"</p><p>, "objects" : "versionId"</p><p>, "accessToken" : "token"</p><p>, "class" : "embeddedViewFrame"</p><p>, "onInitialized": function() {if (window.output) { output.write("API ready"); }} //callback function to run code on viewer load };</p><p> var viewer = new EmbeddedViewer(viewer_data);</p><p></script></p><p></body></p><p></html> 4. API List</p><p>The following API calls are available for use with the Embedded Viewer:</p><p>API calls that request data will receive the data within a callback function</p><p> addToSelection Description</p><p>Append objects to the current selection</p><p>API viewer.addToSelection(str_arr,bl_recrsv);</p><p>Input Parameters</p><p>Input 1: String array of external object IDs</p><p>Input 2: Boolean true/false for retrieval of nested objects within the specified objects</p><p>Output</p><p>None</p><p> getExternalIds Description</p><p>Get the collection of external IDs corresponding to a string array of internal IDs.</p><p>API viewer.getExternalIds(str_arr,callback);</p><p>Input Parameters</p><p>Input 1: String array of internal object IDs</p><p>Input 2: A callback function with 1 argument, e.g. function(stringArrayResult){ }</p><p>Output</p><p>Callback function containing returned string array</p><p> getObjectCount Description</p><p>Get the total number of objects loaded in the viewer</p><p>API viewer.getObjectCount(callback);</p><p>Input Parameters</p><p>Input: A callback function with 1 argument, e.g. function(integerResult){ }</p><p>Output</p><p>Callback function containing returned integer</p><p> getObjectsRange Description</p><p>Get an array of external IDs for objects within the specified index range</p><p>API viewer.getObjectsRange(int_from,int_to,callback);</p><p>Input Parameters</p><p>Input 1: The starting index [integer] of the collection of object IDs to retrieve</p><p>Input 2: The ending index [integer] of the collection of object IDs to retrieve</p><p>Output</p><p>Callback function containing a string array of external IDs</p><p> getProperties Description</p><p>Get the properties of objects specified in a string array of external IDs</p><p>API viewer.getProperties(str_arr,callback);</p><p>Input Parameters</p><p>Input 1: A string array of external IDs Input 2: A callback function with 1 argument, e.g. function(stringArrayResult){ }</p><p>Output</p><p>Callback function containing a string array of external IDs</p><p> getSelected Description</p><p>Get the collection of currently selected objects</p><p>API viewer.getSelected(callback);</p><p>Input Parameters</p><p>Input: A callback function with 1 argument, e.g. function(stringArrayResult){ }</p><p>Output</p><p>Callback function containing a string array of external IDs</p><p> hide Description</p><p>Hide the specified objects</p><p>API viewer.hide(str_arr);</p><p>Input Parameters</p><p>Input: A string array of external IDs</p><p>Output</p><p>None</p><p> highlight Description</p><p>Highlight the specified objects</p><p>API viewer.highlight(str_arr,bl_recrsv);</p><p>Input Parameters</p><p>Input 1: A string array of external IDs</p><p>Input 2: Boolean true/false for highlighting of nested objects within the specified objects</p><p>Output</p><p>None</p><p> hideType Description</p><p>Hide all objects of the specified type within the viewer [Walls, Doors, etc]</p><p>API viewer.hideType(str_type);</p><p>Input Parameters</p><p>Input: String name of object type</p><p>Output</p><p>None</p><p> getInternalIds Description</p><p>Get the collection of internal IDs corresponding to a string array of external IDs</p><p>API viewer.getInternalIds(str_arr,callback);</p><p>Input Parameters</p><p>Input 1: A string array of external IDs</p><p>Input 2: A callback function with 1 argument, e.g. function(stringArrayResult){ }</p><p>Output</p><p>Callback function containing a string array of internal IDs</p><p> removeFromSelection Description</p><p>Remove specified objects from the current selection</p><p>API viewer.removeFromSelection(str_arr,bl_recrsv);</p><p>Input Parameters</p><p>Input 1: A string array of external IDs</p><p>Input 2: Boolean true/false for removing nested objects within the specified objects</p><p>Output</p><p>None</p><p> reset Description</p><p>Reset object visibility, object selection, and camera position</p><p>API viewer.reset();</p><p>Input Parameters</p><p>Input: None</p><p>Output</p><p>None</p><p> selectByName Description</p><p>Select object by name</p><p>API viewer.selectByName(str_name,bl_recrsv);</p><p>Input Parameters Input 1: The string name of the object to select</p><p>Input 2: Boolean true/false for selecting nested objects within the specified object</p><p>Output</p><p>None</p><p> setMaterial Description</p><p>Set the material property in Trimble Connect for the specified objects</p><p>API viewer.setMaterial(str_arr,str_material,bl_recrsv);</p><p>Input Parameters</p><p>Input 1: A string array of external IDs</p><p>Input 2: The string name of the material to set</p><p>Input 3: Boolean true/false for applying material to nested objects within the specified object</p><p>Output</p><p>None</p><p> setSelection Description</p><p>Select a specified set of objects, and clear the prior selection if any.</p><p>API viewer.setSelection(str_arr,bl_recrsv);</p><p>Input Parameters</p><p>Input 1: A string array of external IDs</p><p>Input 2: Boolean true/false for selecting nested objects within the specified objects</p><p>Output</p><p>None</p><p> show Description</p><p>Show the specified objects within the viewer</p><p>API viewer.show(str_arr);</p><p>Input Parameters</p><p>Input 1: A string array of external IDs</p><p>Output</p><p>None</p><p> showType Description</p><p>Show all objects of the specified type within the viewer [Walls, Doors, etc]</p><p>API viewer.showType(str_type);</p><p>Input Parameters</p><p>Input: String name of object type</p><p>Output</p><p>None</p><p> zoom Description</p><p>Zoom to the specified objects within the viewer</p><p>API viewer.zoom(str_arr);</p><p>Input Parameters</p><p>Input 1: A string array of external IDs Output</p><p>None</p><p>5. Appendix</p><p>5.a Glossary</p><p>Embedded Viewer Parameters: title //viewer title to display on web page noProperties //display properties panel noLeft //display left panel debug //output debug messages height //viewer height width //viewer width gteamOrigin //Trimble Connect home page URL projId //Project ID - refer to 2.c.2. objects //Objects ID - refer to 2.c.3. mashup //Mashup ID - refer to 2.c.4. accessToken //access token string class //object class name onInitialized //callback function</p><p>External ID The external ID is the unique ID of each object that is assigned to it by Trimble Connect.</p><p>The external ID of each object is unique for each file revision.</p><p>The external ID is used to identify objects within a specific revision of a file.</p><p>Internal ID The internal ID is the unique ID of each object that is assigned to it by its authoring environment. This ID is usually persists through file revisions for objects that are unmodified.</p><p>5.b Javascript php post request code:</p><p>The sample code below uses a jquery http://jquery.com/ ajax post to call a php file.</p><p>$.ajax({</p><p> type: 'POST',</p><p> url: 'auth/get_actkn.php',</p><p> async: false,</p><p> success: function(result){</p><p> console.log("Access Token = " + result);</p><p>},</p><p> error: function(){</p><p>}</p><p>});</p><p>The sample code below uses a dojo http://dojotoolkit.org/ javascript post to call a php file.</p><p> define([</p><p>"dojo/_base/declare","dojo/request"</p><p>], function(declare, request){</p><p> return declare(null, {</p><p> getAccessToken: function() {</p><p> return request.post("auth/get_actkn.php", {</p><p>}).then(function(result) {</p><p> return result; //the access token is returned here</p><p>}); }</p><p>});</p><p>});</p>
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages49 Page
-
File Size-