Loading...
 

API Access Example

This is a quick demo of how to use the Tiki 24+ API from JavaScript.

First (recommended) create a new Tiki user and grant it the minimum permission it will need, in this case it's called api_access and can it create items on tracker 35, and nothing much else...

Then create an oauth client on tiki-admin_oauthserver.php
New Oath Client
The client ID and secret will be generated for you
New Oath Client After

Then create a JavaScript file, in this case it's called custom.js and lives in themes/js (it will be automatically included in the page for you, and minified if necessary).

themes/js/custom.js
Copy to clipboard
$(document).ready(function () { // create tracker item via api demo function createTrackerItem() { // testing locally const authUrl = "http://localhost/tiki/tiki/api/oauth/access_token", authData = { grant_type: "client_credentials", client_id: "04a5d956587fc882853d8e9f2a3c46cf", client_secret: "d8e06397c589c4e11b957fa59e5afda6861a1547c949c4201c298fa18eb92b61", } let access_token = "" // get authorisation token for our api_access user $.ajax({ url: authUrl, data: authData, async: false, // naughty? but need to wait for the token, probably better done on page load once dataType: "json", }).done(function (data) { access_token = data.access_token }).fail(function () { alert("error"); }) if (! access_token) { return } // now to create the tracker item - see http://localhost/tiki/tiki/api/ for more const url = `http://localhost/tiki/tiki/api/trackers/${trackerId}/items` // need the date in unix format (seconds since 1970) const now = parseInt((new Date()).getTime() / 1000); // the demo tracker id const trackerId = 35 const payLoad = { "fields": { "newsTitle": "a test title", "newsURL": "https://tiki.org", "newsSummary": "a test news summary", "newsDate": now, } } // now run the request $.ajax({ url: url, data: payLoad, dataType: "json", method: "post", headers: { Authorization: `Bearer ${access_token}` }, }).done(function (data) { //debugger; alert(`Item ${data.itemId} was created`) }).fail(function () { debugger alert("error"); }) } if (confirm("do it?")) { createTrackerItem(); } });

Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting
Administration
Ajax
Articles & Submissions
Backlinks
Banner
Batch
BigBlueButton audio/video/chat/screensharing
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution
Cookie
Copyright
Credits
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Diagram
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs
DogFood
Draw -superseded by Diagram
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Gantt
Group
Groupmail
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Kanban
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping
Mobile
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Packages
Payment
PDF
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Scheduler
Score
Search engine optimization (SEO)
Search
Security
Semantic links
Share
Shopping Cart
Shoutbox
Site Identity
Slideshow
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
Syntax Highlighter (Codemirror)
Tablesorter
Tags
Task
Tell a Friend
Terms and Conditions
Theme
TikiTests
Federated Timesheets
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
Webmail and Groupmail
WebServices
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives
WYSIWTSN
WYSIWYCA
WYSIWYG
XMLRPC
XMPP




Useful Tools