Tuesday, 4 April 2017

PHP and TACTIC Rest API

TACTIC 4.6 just introduced a new generic REST API which implements most of the TACTIC API.  This opens up the TACTIC API to almost all programming languages.   There are still some advantages to using the client side libraries for Python and Javascript as there is some custom convenience and logic written in the client side libraries.  However, for many important operations, the rest API is sufficient.  This is especially useful when integrating TACTIC with such platforms as WordPress or Drupal or AngularJS.

Since the TACTIC API functionality is very deep, the first REST implementation has been to only support POST requests.   This provides the access to all of the arguments of the API methods without the inconvenient limitation of using a URL to provide all of the arguments to methods.

The following example will made use of the PHP curl functionality wrapped up in a convenience function.  It is assumed that you already have a login ticket.  A login ticket is any non-expired entry in the "ticket" table in the "sthpw" database.

The following function wraps up all the settings needed to access a TACTIC server:

function executeREST($data) {
    $server = "http://tactic.server.com";
    $login_ticket = "8f096a8359bbc355943f93545684b90e";
    $project = "my_projects";
    $url = $server."/".$project."/rest";
    $data['login_ticket'] = $login_ticket;


    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_FAILONERROR, true);

    $result = curl_exec($ch);
    if (curl_error($ch)) {
        throw new Exception(curl_error($ch));
    }
    $result = json_decode( $result );
    return $result;
}

With this function, we can access the api simply with a single line.  We can start with a simple ping.

$data = [
    'method' => 'ping'
];
echo executeREST($data);

This should print "OK", which means that the code has contacted the TACTIC server and was authenticated.  The method

Next, we can try a simple sobject with a search key:

$data = [
    'method' => 'get_by_search_key',
    'search_key' => $search_key,
];
print executeREST($data);

And we can also use expressions:

$data = [
    'method' => 'eval',
    'kwargs' => json_encode( [
        'expression' => '@SOBJECT(workflow/asset)',
        'single' => true,
    ] ),
];
$result = executeREST($data);

Note the difference in the arguments between this method (eval) and the last (get_by_search_key).  There are two ways for arguments to be passed through and both are valid for either function.  You can use the arguments explicitly or you can wrap the arguments in a kwargs key.  However, the kwargs key is assumed to be JSON encoded and allows for complex data structures to be passed through.  The post interface does not allow for complex data structures, so these should be JSON encoded.

This opens up the TACTIC API to many languages, in particular PHP and Ruby which are used in server side processing of popular web platforms.  All of these platforms have a very weak ability to handle complex data and really have no asset management capabilities.  This API makes it easy to integrate a powerful back-end with these content delivery systems.













114 comments:

  1. Replies
    1. IEEE Final Year projects Project Center in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Project Domains for IT It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, project projects for cseAngular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
    workday studio online training
    best workday studio online training
    top workday studio online training

    ReplyDelete
  3. Android App Development Company Noida for iOS Apps. Android App Development Services in Noida.
    android app development company in noida

    ReplyDelete
  4. Informative blog. cloudshinepro.com offers industry standards training that will help you in landing a good job. Visit us on Oracle Fusion Product Management India

    ReplyDelete
  5. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website. Sports & Fitness

    ReplyDelete
  6. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website

    Solar Power

    ReplyDelete
  7. App Development Company in Delhi - One of the best Android App Development company in Delhi. We offer best Android application development services
    app development company in delhi

    ReplyDelete
  8. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot.

    SAP Online Training

    SAP Classes Online

    SAP Training Online

    Online SAP Course

    SAP Course Online

    ReplyDelete
  9. Nice post! thanks for sharing. Marriage problem solutions - Are you facing problems in married life? They seems to be unending then do not worry.
    Website: online astrology free

    ReplyDelete
  10. It’s a really very awazing post. I really like it very much. Thanks for sharing.
    antique jewellery

    ReplyDelete
  11. I have read your article, it is really interesting and has lots of useful information. I also recommend it to friends so they can read it and they see the same thing
    Website: Matka Charts

    ReplyDelete
  12. Hello! This is my first visit to your blog! This is my first comment here, so I just wanted to give a quick shout out and say I genuinely enjoy reading your articles.
    Best Adventure Tour Packages

    ReplyDelete
  13. This is my first comment here, so I just wanted to give a quick shout out and say I genuinely enjoy reading your articles. Thanks for sharing.
    SattaMatka | satta result | satta king online | satta king chart | indiansatta

    ReplyDelete
  14. Computer Network Technician are responsible for helping to create, maintain and troubleshoot problems with the hardware and software products used as part of a computer network. They can also take steps to prevent any future problems arising.

    ReplyDelete
  15. Great post! thanks for sharing.! this site are good after reading..so awesome.
    Website: Kalyan Matka

    ReplyDelete
  16. Mobile App Development Company Delhi: We have the Top iPhone Android app developers team, offering custom mobile app development company in delhi.

    ReplyDelete
  17. Thanks for sharing this information. I have shared this link with others keep posting such information.
    Visit : Satta Matka|Jodi chart| panel chart|Matka Guessing Tricks

    ReplyDelete
  18. Hope you will keep on offering good content like this more often. I feel more and more people should know about this
    Website :- AC repair Service

    ReplyDelete
  19. Thank you for sharing such a useful post. Very Interesting Post! I regularly follow this kind of Blog.
    Visit here: matka results

    ReplyDelete
  20. I am very glad to here it is very good post. Thanks for sharing
    Apply for csp

    ReplyDelete
  21. Post is very good its amzazing post I love them thanks for sharing.
    visit here- election result comedy

    ReplyDelete
  22. it is really a great and helpful piece of info. I am glad that you shared this helpful information with us. Please keep us informed like this. Thank you for sharing.
    Assignment Help

    ReplyDelete
  23. Ayonz is a Market Development Company in Sydney provides a service solution that is end-to-end like technology design, manufacturing, supply & brand development for consumer lifestyle products sold in retail, through resellers or online shopping channels.

    ReplyDelete
  24. Play premier league fantasy cricket on India's no.1 App and get a chance to win up to 50 lakhs in every match. Download the app now!

    ReplyDelete
  25. I always like to read a quality content having accurate information regarding the subject and the same thing I found in this post. Nice work
    Visit here :- Punjab state lottery

    ReplyDelete
  26. it is really a great and helpful piece of info. I am glad that you shared this helpful information with us. Please keep us informed like this. Thank you for sharing.
    malaysia visa

    ReplyDelete
  27. it is really a great and helpful piece of info. I am glad that you shared this helpful information with us
    Packers and Movers Gwalior

    ReplyDelete

  28. Top quality blog with unique content and information shared was valuable looking forward for next updated thank you
    Ethical Hacking Course in Bangalore

    ReplyDelete
  29. Post is very good its amzazing post I love them thanks for sharing.
    visit here - cartoon wala funny video

    ReplyDelete
  30. Wonderful blog! Do you have any tips for aspiring writers? I'm planning to start my own site soon but I'm a little lost on everything. Would you suggest starting with a free platform like Wordpress or go for a paid option? There are so many choices out there that I'm totally confused .. Any recommendations? Thanks!
    SEO Expert Gwalior

    ReplyDelete
  31. Wonderful blog! Do you have any tips for aspiring writers? I'm planning to start my own site soon but I'm a little lost on everything.
    Website property in jaipur

    ReplyDelete
  32. Appslure is an award-winning mobile app development company building feature-packed and interactive mobile applications for startups, medium and large enterprises.

    ReplyDelete
  33. it is really a great and helpful piece of info. I am glad that you shared this helpful information with us. Please keep us informed like this. Thank you for sharing.
    Website: Online punjab state lottery

    ReplyDelete
  34. Ducted Air Conditioners is usually a whole home solution that allows you condition multiple rooms or the entire house using just one system. The Indoor Unit is usually located in the ceiling or Under the floor.

    ReplyDelete
  35. Roman Daniels Corporate is one of Australia’s favourite providers of corporate wear and we are looking forward to doing the same great job in New Zealand.

    Roman Daniels Corporate is one of Australia’s favourite providers of corporate wear and we are looking forward to doing the same great job in New Zealand.



    ReplyDelete
  36. I am new here. I like your post very much. It is very usefull post for me.
    website: 5G Infrastructure Market

    ReplyDelete
  37. Nice post...Keep it up...
    Nio Stars Technologies LLP is Best Seo Services Agency in UsA. Search Engine Optimization helps to promote your brand and grow your business on search engine.

    ReplyDelete
  38. Situs stlouisresumeservice merupakan Web Pasang Togel Online Terpercaya Pasaran Terlengkap yang memberikan kalian keuntungan besar dengan semua yang dibutuhkan oleh para pemain. Jadi, bermainlah di situs bandar togel Asia Coloktoto.

    ReplyDelete
  39. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
    top online electronics shopping sites in india

    ReplyDelete
  40. I always like to read a quality content having accurate information regarding the subject and the same thing I found in this post.

    Website Development Company |

    ReplyDelete
  41. Great information, i was searching of this kind of information, thank you very much for sharing with us.

    Website : Craigslist Posting Service for Car Dealers |

    ReplyDelete
  42. This is really amazing website that I have been found on google regarding website Blog Commenting sites. and I would like to thank admin who also given us to post the link on his side.

    Lubbock moving company |

    ReplyDelete
  43. This was something I was looking for, really helpful, and great work is done. Thank you so much for sharing such valuable information.

    Car Auction Software |

    ReplyDelete
  44. It’s really a cool and helpful piece of information. I am glad that you shared useful information with us. Please keep us up to date like this. Thanks for sharing.

    Best CRM for Small Businesses |

    ReplyDelete
  45. I am really like it very much for the interesting info in this blog that to this website is providing the wonderful info in this blog that to utilize the great technology in this blog.

    Web Development Company in Gwalior |

    ReplyDelete
  46. web developer, This was incredibly an exquisite implementation of your ideas, and if you need then come visit us!

    ReplyDelete
  47. Tekniko Global is an award-winning mobile app development company in Delhi and other city or countries. We develop high-quality.

    ReplyDelete
  48. Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! New York Custom Website Design

    ReplyDelete
  49. I am glad to discover this page. I have to thank you for the time I spent on this especially great reading !! I really liked each part and also bookmarked you for new information on your site.
    Data Science Training in Chennai

    ReplyDelete
  50. Hey Wonderful information, Thanks a lot sharing kind of information. Your website gives the best and the most interesting information. Free Astrology consultation on phone

    ReplyDelete
  51. Good. I am really impressed with your writing talents and also with the layout on your weblog. Appreciate, Is this a paid subject matter or did you customize it yourself? Either way keep up the nice quality writing, it is rare to peer a nice weblog like this one nowadays. Thank you, check also virtual edge and thank you for speaking at our event

    ReplyDelete
  52. Thank you very much for writing this blog. It was very easy to understand.

    Marriage Garden in Gwalior |

    ReplyDelete
  53. I always like to read a quality content having accurate information regarding the subject and the same thing I found in this post.
    Web Development Company in Gwalior |

    ReplyDelete
  54. I am really like it very much for the interesting info in this blog that to this website is providing the wonderful info in this blog that to utilize the great technology in this blog.
    Website Development Company in Gwalior |

    ReplyDelete
  55. It’s really a cool and helpful piece of information. I am glad that you shared useful information with us. Please keep us up to date like this. Thanks for sharing.
    Best CRM for Small Businesses |

    ReplyDelete
  56. This was something I was looking for, really helpful, and great work is done. Thank you so much for sharing such valuable information.
    Car Auction Software |

    ReplyDelete
  57. This is really amazing website that I have been found on google regarding website Blog Commenting sites. and I would like to thank admin who also given us to post the link on his side.
    Lubbock moving company |

    ReplyDelete
  58. Great information, i was searching of this kind of information, thank you very much for sharing with us.
    Craigslist Posting Service for Car Dealers |

    ReplyDelete
  59. Award-winning mobile app development agency. Our android application development company builds custom mobile apps for 7+years. Over 600+ clients served.
    mobile app development agency

    ReplyDelete
  60. This was something I was looking for, really helpful, and great work is done. Thank you so much for sharing such valuable information.
    revistaneon.net

    ReplyDelete
  61. Computer networks are the basis of communication in IT. They are used in a huge variety of ways and can include many different types of network.

    ReplyDelete
  62. Awesome article. I enjoyed reading your articles. this can be really a good scan for me. wanting forward to reading new articles. maintain the nice work!
    Data Science Courses in Bangalore

    ReplyDelete
  63. I am sure it will help many people. Keep up the good work. It's very compelling and I enjoyed browsing the entire blog.
    Business Analytics Course in Bangalore

    ReplyDelete
  64. common it problems Each profession has some challenges. However, the problem with most IT help desks is that they let many issues pile up to the extent that sorting them out becomes difficult. In this piece, you will get to learn about some common help desk problems and solutions.

    ReplyDelete
  65. Excellent Blog! I would like to thank you for the efforts you have made in writing this post. Gained lots of knowledge.
    Data Analytics Course

    ReplyDelete
  66. What an incredible message this is. Truly one of the best posts I have ever seen in my life. Wow, keep it up.
    AI Courses in Bangalore

    ReplyDelete
  67. This is a very nice one and gives in-depth information. I am really happy with the quality and presentation of the article. I’d really like to appreciate the efforts you get with writing this post. Thanks for sharing.
    UiPath course in pune

    ReplyDelete
  68. If you are new at essay writing, it is always better to get some help from assignment help onlinebecause they can guide you well. Though you can do without guidance as well, but there are always chances of coming up with not-so good essay. Because, in the beginning everyone needs someone who can make things look easier and point out at mistakes. Especially, if you are running out of time you should surely take my math class for me think about hiring an expert. Firstly, it will refrain you from losing a deadline. Secondly, experts can educate you on the topic to a great extent. You will surely see positive differences with expert assistance.

    ReplyDelete
  69. Thanks for sharing information with all of us . Who visit your website .good work and great stuff .
    Website Designing Company in Noida

    ReplyDelete
  70. Great article! This is the type of information that are meant to
    be shared across the internet. Thank you for sharing such a useful post. Very Interesting Post! I regularly follow this kind of Blog.
    visit this page

    ReplyDelete
  71. If you are among the students who need the assignment help in the Australia, then you can take help from our Do my assignment online services. We have the team of the professional writers who can provide you online assistance so that you can complete your work before deadlines. Isn’t it a great idea to take help from allassignmenthelp? If yes, then we would provide your work to an expert writer who would be making it possible for you to submit your assignments on time.

    ReplyDelete
  72. It is a great pleasure to read your message. It's full of information I'm looking for and love to post a comment that says "The content of your post is amazing". Excellent work.
    Python course in Nashik
    Python training in Nashik
    Python classes in Nashik

    ReplyDelete
  73. Tubitv.com/activate is an online platform that is a creation of Fox Corporation and stream the latest content and videos of your interest. In comparison to Netflix, the platform is free to access and you can watch as many as movies you want for free with the help of tubi.tubi.tv/activate

    ReplyDelete
  74. Here I am for the first time, and I found beneficial information. I am really impressed with the information. I look forward to more comprehensive and insightful posts like this in the future. Keep up the good work.

    office.com/setup | mcafee.com/activate | office.com/myaccount

    ReplyDelete
  75. If take my online Political Science class for me? The political science subject focuses mostly on local, national, and worldwide practicing of government & politics as we have talked about before. This provides greater support in improving the knowledge & practices of institutions and their relationships with others as a way of promoting citizenship through different research methods as well as public life. You have better guidance on study and analysis of the government and political procedures with the take my online class for me.

    ReplyDelete
  76. It is a great pleasure to read your message. It's full of information I'm looking for and love to post a comment that says "The content of your post is amazing". Excellent work.
    Python course in Nashik
    Python Training in Nashik
    Python classes in Nashik

    ReplyDelete
  77. Are you looking for someone who can be pay someone to write my term paper? That's the website you want to work on. Our team is skilled in homework assignments for various institutions and academic areas. You can spend your time writing help at our minimal price throughout the completion of your homework. We look forward to working with you through top-class assignment assistance.

    ReplyDelete
  78. This is a very nice one and gives in-depth information. I am really happy with the quality and presentation of the article. I’d really like to appreciate the efforts you get with writing this post. Thanks for sharing.
    Full stack Training in kolkata

    ReplyDelete
  79. Dealing with endless assignment supplies and practical sessions can be tiring enough. Some of you may have to take care of attendance as well. All of this can be a source of stress for young people. But do not let anything take away your sanity. There is always a way to ease out things. You can get help from experts. It is easy to find genuine Assignment Writing Service UK. All you need is a little bit of time and a clear mind to carry out the search. There are higher chances that you will find something suitable in less than an hour. Know more visit: https://www.allassignmenthelp.co.uk/assignment-writing-service.html

    ReplyDelete
  80. Here you will find qualified and experienced experts for do my homework so that you need not worry about the quality of work. At domyhomework.us we know that meeting deadlines is an important part of earning a excellent grades. We have several high quality writers who can meet deadlines without any problem at all. If the first draft of the Assignment does not meet your needs, we offer free revisions so that will help you get the best grade from your teacher.

    ReplyDelete
  81. Great thanks for sharing it had been very informative blog. A useful wording may be a good way to spotlight the many aspects of the subject keep it up. paid thesis writers

    ReplyDelete
  82. Dealing with endless assignment supplies and practical sessions can be tiring enough. Some of you may have to take care of attendance as well. All of this can be a source of stress for young people. But do not let anything take away your sanity. There is always a way to ease out things. You can get help from experts. It is easy to find genuine all assignment help All you need is a little bit of time and a clear mind to carry out the search. There are higher chances that you will find something suitable in less than an hour.

    ReplyDelete
  83. I am glad to discover this page. I have to thank you for the time I spent on this especially great reading !! I really liked each part and also bookmarked you for new information on your site.
    Data Science Training in Chennai

    ReplyDelete
  84. Our online assignment help online
    is available around the world and offers fully online and offline transparency and communication, so you know you trust the right place. We give you the best assignment help online, from fresher’s to senior-year students. We are committed to make your life easier and allow you to breathe in your home.

    ReplyDelete
  85. You have completed certain reliable points there. I did some research on the subject and found that almost everyone will agree with your blog.

    Data Science Training in Bangalore

    ReplyDelete
  86. Wonderful blog found to be very impressive to come across such an awesome blog. I should really appreciate the blogger for the efforts they have put in to develop such amazing content for all the curious readers who are very keen on being updated across every corner. Ultimately, this is an awesome experience for the readers. Anyways, thanks a lot and keep sharing the content in the future too.

    Digital Marketing Training in Bangalore

    ReplyDelete
  87. I wanted to leave a little comment to support you and wish you the best of luck. We wish you the best of luck in all of your blogging endeavors.

    Artificial Intelligence Training in Bangalore

    ReplyDelete
  88. The Extraordinary blog went amazed by the content that they have developed in a very descriptive manner. This type of content surely ensures the participants explore themselves. Hope you deliver the same near the future as well. Gratitude to the blogger for the efforts.

    Machine Learning Course in Bangalore

    ReplyDelete
  89. There are several reasons behind the popularity of pilot training and pilot courses in Delhi, the first being the use of special effects and pilots in films and TV shows. best dgca ground classes in delhi. Pilot and pilot training animations are being widely used in TV programs and film production as they enhance the visual of the same. Even brands and businesses are using pilot training in their video marketing strategies to capture the attention of viewers these days.

    ReplyDelete
  90. This is a very nice one and gives in-depth information. I am really happy with the quality and presentation of the article. I’d really like to appreciate the efforts you get with writing this post. Thanks for sharing.
    CCNA training in Ahmednaga

    ReplyDelete
  91. This programming language is very useful for us and through this, we can make our future secure. Jobless persons can learn it and make their future bright. Dissertation writing services.

    ReplyDelete
  92. 123.hp.com setup of HP printers. We offer assets delivered by 2019 like drivers, programming and the 123.hp.com/introduce Printer setup manual.

    ReplyDelete
  93. Deadlines are often scary. Aren’t they? If you the same then you are in need of someone who can wipe this fear away. And professional assignment help can do this thing in such a smooth way that you will not even realize. All you have to do is to carry out a little bit of research on the web.
    online assignment help
    do my assignment
    programming assignment help
    java assignment help
    php assignment help
    essay helper
    dissertation help
    IT assignment help

    ReplyDelete
  94. Dealing with endless assignment supplies and practical sessions can be tiring enough. Some of you may have to take care of attendance as well. All of this can be a source of stress for young people. But do not let anything take away your sanity. There is always a way to ease out things. You can get help from experts. It is easy to find genuine Buy Essay Online. All you need is a little bit of time and a clear mind to carry out the search. There are higher chances that you will find something suitable in less than an hour.

    ReplyDelete