Save yourself 20 seconds
I got a bit tired of trying to remember what URLs to use so I put this in the footer for myself. Thought I'd share. Now all I have to do is open the console and I'll know the Freemarker and Community versions we're on. <#if !user.anonymous> <#if user.login == "Per"> <#assign currentVersion = restadmin("/settings/name/maintenance.current_version").value/> <script> var objCommVersion = JSON.parse('${currentVersion}'); console.log('Hello ${user.login}!\n\n'); console.log('Versions:'); console.log('Freemarker: ${.version}'); console.log('Community: ' + objCommVersion.version.major + '.' + objCommVersion.version.minor + '.' + objCommVersion.version.point); </script> </#if> </#if>81Views5likes1CommentGet IP address using REST call.
Hi All, One very quick quetion. I want the two IP addresses using REST api call : 1. IP address when user registers to community. 2. IP address of user's last visit. Please reply as fast as possible. Thank you in advance. Regards, Vishwajeet.Solved237Views0likes4CommentsHow to get media version in freemarker?
Hi, Using following text key we are able to get the media title. ${text.format("form.FeatureVersion.field.media.title")} Could you please suggest us, how to get current media version selectedin the Studio>>Features>>Media in Free marker. Thanks & Regards, Phaniphani9 years agoAdvisor50Views0likes0CommentsLithium Angular Library is not calling custom angular app controllers
Hi, We are using Lithium Angular Freemarker directive to register our custom angular app with Lithium angular app. But our controller is not calling. Following is code sample. <div id="testContrlApp" ng-controller="testContrl"> Angular Test </div> <@liaAddScript angular="true"> ;(function (angular) { /* Registering the app with Lithium Angualr App */ var coreModuleDeps = LITHIUM.AngularSupport.getOptions().coreModuleDeps || []; coreModuleDeps.push('testContrlApp'); LITHIUM.AngularSupport.setOptions({ coreModuleDeps: coreModuleDeps }); angular.module('testContrlApp',[]) .config(['$httpProvider', function ($httpProvider) { /* Executing */ console.log("Going into Connfig"); }]) .controller('testContrl',function($scope){ /* Controller */ /* Not Executing */ alert("This is angualr code from controller") }); })(LITHIUM.angular); </@liaAddScript> Could you please guide us to resolve this issue. Thanks & Regards, PhaniSolvedphani9 years agoAdvisor198Views0likes1CommentCustom images on RSS feed
We created a custom Gallery board to list Forum posts with a thumbnail image, which is added to the post as an attachment. We used this approach because we don't want to have the thumbnail image in the post body. We have no problem with the thumbnails in the Gallery, but the thumbnails are not being included in the RSS feed. How can we update or modify the RSS feed of that board in order to include the attached thumbnail images as the feed item image? We believe we should change how the feed is generated, adding the <enclosure> tag on each feed item in order to specify the thumbnail image, but if someone have another idea, it would be helpful.nicolasbajko9 years agoHelper102Views0likes2CommentsReal-time (asynchronous) notification count
Hi all, We're testing some notification stuff, and are utilizing this built-in widget to show the current user's notification count: notificationfeed.widget.indicator We need the count to display in real-time, or asynchronously, without the user refreshing the page--but this doesnt seem to be the case. Is this true? Is there any options/settings to change this, or is there a different widget that can do what i've described better? thanks Tri99Views0likes2CommentsHow many Lithium data export options i can choose
Hi, I'm newbie of lithium. I'm currently evaluating the platform and we have requireme of pull the forum data to 3rd party tools for custom analytics. I want to know which method Lithium can provide to customer about getting data from their nodes. I know the Community/Bulkdata API can be the options. Is there any other way to do that as well? Thanks Fenglinlfl10019 years agoContributor204Views0likes4CommentsCustom tooltip in component
Is there a way to replicate the functionality of the tooltips that are used in Lithium? I have tried using the same markup in my custom components but the popup text does not work even though I have assigned a unique ID to the containers. The markup is identical to others that are used except for the ID. I found another post about it but it was dated back to four years ago and the resources linked have since vanished (jquerytools.org for example). <span class="HelpIcon"> <a class="lia-link-navigation help-icon lia-tooltip-trigger" id="link_2" href="#"> <span class="lia-img-icon-help lia-fa-icon lia-fa-help lia-fa" id="display_2" alt="${tooltiptext}"></span> </a> <div class="lia-content lia-tooltip-pos-bottom-left lia-panel-tooltip-wrapper" id="link_2-tooltip-element"> <div class="lia-tooltip-arrow"></div> <div class="lia-panel-tooltip"> <div class="content">${tooltiptext}</div> </div> </div> </span> This is the code I am using in my component. The element renders fine but the lia-panel-tooltip-wrapper does not get cloned to the bottom of the page like the others do. Any tips? (see what I did there!)jaread839 years agoChampion79Views0likes0CommentsAdmin settings via REST API
Hi all, I am trying to retreive some settings in the admin panel via REST for file attachments so I can display limitations to users such as filesize, max uploads and filetypes. I found that someone else asked the same question and the answer involved turning on the text keys to get the text string to include in the REST call. The only problem with this is that recently the text keys do not show up in Studio or Admin so I have no way of finding out how to get the settings name to retreive the data. This is the original solution: http://community.lithium.com/t5/Developers-Discussion/Where-to-find-all-the-community-admin-settings-by-api/m-p/216806#M10045 But because of the lack of text keys being displayed in the admin panel, I am unable to retreive the settings via REST. Can anyone help me out?Solvedjaread839 years agoChampion187Views0likes1CommentCan we use macros in velocity email templates?
We're looking to track the user clicks on an email sent and we're doing that by passing a query string param. The problem is I cannot just append to the URL's in the email template. /foo/bar#M436?referer=1 is invalid URL whereas I need to do : /foo/bar?referer=1#M436. To achieve this, I need to parse url with something like... #macro( parse_url $url) #set ($hash_index = $url.indexOf('#')) #if( $hash_index > -1 ) #set ($first_part = $url.substring(0, $hash_index)) #set ($second_part = $url.substring($hash_index)) #set ($new_url = "${first_part}?referer=1${second_part}") #else #set ($new_url = "${url}?referer=1") #end #end #parse_url( ${notification.message.webUi.url} ) I have had no luck to get this to work :http://velocity.apache.org/engine/1.7/user-guide.html#velocimacros It does work, however, if I get rid of the macro. Any input is appreciated. Also - does Lithium provide any tracking through a dashboard on number of click activity via email?gstelang9 years agoMentor68Views1like0CommentsStrip parameters from http.request.url URL
Hi, So we had an issue with gating attachments. We wanted to make sure all users had to login/register to access attachments. This worked fine until an event sent out an email with a link to an article on our community, but with tracking codes in the URL. When the user clicks an attachment, they get redirected to login, but then it tries to redirect them back the article with all the tracking codes attached. These actually cause it to error out and redirects to our support website (our server default I suppose, not sure). I want to strip out the tracking codes, which begin with "?stc=". This is the code I have: <#if user.anonymous> // if user is anonymous <#attempt> <@liaAddScript> (function($) { var referrer = ${http.request.url?keep_before("?stc=")}; // set referrer to the current URL but cleaned up var loginUrl ='LOGINURL?url='+referrer; // append referrer to the login url for a redirect jQuery('a.attachment-link').attr('href',loginUrl); // pop this login + referral URL into attachment anchors })(LITHIUM.jQuery); </@liaAddScript> <#recover> </#attempt> </#if> I got the concept of gating attachments to anonymous users from here, and that works as expected. It's only now that I'm trying to modify ${http.request.url} that it isn't working at all. The sample code actually used "window.location.href" for the referral, but I don't know how I would go about removing the tracking codes from that. I also looked into js strip() but I'm not knowledgeable enough in it (or Freemarker) to figure this out. I'm currently adding this to the page wrapper. Thanks, KatieKaitlinSaxton9 years agoAdvisor157Views0likes1CommentRetrieving Session Variable Profile.Language
I'm looking for some help accessing the session variable necessary to detect what language the user has set on their account. The session variable should already be set when they log in; I imagine that I just need to access it with a REST api call. The overall objective is to detect what language their account is in and redirect them to a URL with the appropriate language pack enabled. Does anyone have any insight on creating the endpoint api call to check the profile.language setting?Solved198Views0likes3CommentsPost blog article via API
Hi, does anyone know of any way of posting blog articles via API? We are looking at using a new content management tool to oversee approval processes etc. internally which will categorise content. The content will then all be present in one location and which will currently then be needed to be uploaded into Lithium, this will result in the work being done almost twice. Does anyone know if you can upload a blog article directly into the system via API? I can go into a fair bit more detail if needed but if it's not remotely possible then there's not much point. Thanks, Dom96Views1like1CommentAccess to the specified resource has been forbidden
Hello, When attempting to use the REST API and make any calls to the community API , I am getting the following error. "Access to the specified resource has been forbidden" I have admin access to the community and have granted my user REST API access. I am doing a POST to the following endpoint: curl -XPOST 'http://<community url>/restapi/vc/authentication/sessions/login?user.login=<user login>&user.password=<user password>' Any assistance will be much appreciated.kclark9 years agoContributor87Views0likes1CommentHow do I get the currently logged-in user details like avatar, id and Name using Javascript?
Hi, We are having a JS based widget that would need to display basic user details like the avatar, name and a unique id. Is this information available via cookies or can we make REST API call to get this data? Thank you, SrikanthSolvedsriray9 years agoContributor463Views0likes4CommentsEmbedded pictures dont work in post
Dear Helpdesk, In the Lithium Forum integration for Vodafone Germany we have a problem when we want to send a post reply from our system with an embedded picture. Today at 11:24:35 I tried to send a post with embedded picture "sun_blade_1000_h400px.jpg" and I've got following error back: "Upload result status code: 403... Access to the specified resource has been forbidden." (URL called: https://forum-stage.vfd2-testnet.de/restapi/vcusers/login/Hanni_Marteau/media/albums/default/public/images/upload) Please check in the logs from your side, what is the root cause of the issue exactly. Here is log snippet from our side: 2016-07-28T11:24:35.534 Dbg 42256 |U| (channel-lithium).(driver).(uploadImageRequest): Assembling comment part: https://forum-stage.vfd2-testnet.de/restapi/vcusers/login/Hanni_Marteau/media/albums/default/public/images/upload?restapi.session_key=JQthWcGhLNtc3B_5_nmkT06htowOQOgvJv0ssvZ8_DI.&credentials.user=%2Fusers%2Flogin%2FHanni_Marteau&restapi.response_format=json 2016-07-28T11:24:35.546 Dbg 42256 |U| (channel-lithium).(driver).(uploadImageRequest): Processing file: 0006YaBPQA0G045C 2016-07-28T11:24:35.738 Dbg 42256 |U| (channel-lithium).(driver).(uploadImageRequest): Download the following file: 0006YaBPQA0G045C to the following location: /opt/genesys/applications/SocialMsg/Workspace/lithiumsun_blade_1000_h400px.jpg 2016-07-28T11:24:35.738 Dbg 42256 |U| (channel-lithium).(driver).(uploadImageRequest): Document to file: C:\Users\jcsajtai\Desktop\sun_blade_1000_h400px.jpg - 132745 - image/jpeg 2016-07-28T11:24:35.779 Dbg 42256 |U| (channel-lithium).(driver).(uploadImageRequest): HTTP protocol: 1.0 2016-07-28T11:24:35.883 Dbg 42256 |U| (channel-lithium).(driver).(uploadImageRequest): Upload result status code: 403 2016-07-28T11:24:35.885 Dbg 42256 |U| (channel-lithium).(driver).(uploadImageRequest): Error. Response: <html><head><title>Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 403 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>Access to the specified resource has been forbidden.</u></p></body></html> 2016-07-28T11:24:35.886 Dbg 42256 |U| (channel-lithium).(driver).(uploadImageRequest): Delete of the the following file was successful: /opt/genesys/applications/SocialMsg/Workspace/lithiumsun_blade_1000_h400px.jpg 2016-07-28T11:24:35.886 Dbg 42256 |U| (channel-lithium).(driver).(uninitializeUCSService): Closing UCS connection 2016-07-28T11:24:35.887 Std 47050 |U| (channel-lithium).(driver).(uploadImageRequest): File upload was unsuccessfull. Thanks in advance, Regards, JuditSolvedjcsajtai9 years agoContributor163Views8likes2CommentsNotification feed or Activity feed
I am trying to include either the Activity feed or notification feed in either a custom page or custom component. To include the activity feed I use: <@component id="forums.widget.activity-feed"/> And for notification feed: <@component id="notification-feed"/> Neither worked. However if I include the notification-feed component on the notification page, it works fine. Which made me think that it needs to be in the context of the notification page. So I copied the page and then included that in my component: <@component id="quilt:custom-notification-page"/> But still no luck. Any tips here why this won't work?131Views0likes0CommentsApplying two skins on same node
Hi, We have 2 skins in our community appliedcategory level. We have a use case where we need to create a board node but skin that should be applied to that node should be dynamic. Meaning if user comes to this node from skin 1 then skin 1 should be applied and if user comes from skin 2 then skin 2 should be applied. Is this possible currently. Another way could be that we have two different node which have different skin applied to them but have data synced. Have anyone came across any such use case. Thanks, SachinADS_PSI9 years agoMentor155Views0likes3CommentsIf logged in, print screen name
Hey Folks, I am after a simple snippet of code but don't know how to write it :( What I am looking for is... if user is anonymous, have text display as "Welcome to the community" otherwise, ifuser is logged in, then the text will read "Welcome [Screen Name]" Is there a way to do this? Thanks in advanced! Cheers NikSolvedniiiiiiiiiik9 years agoGenius196Views0likes2CommentsShow Who Kudoed a Post (working code sample provided!)
Hi everyone, I recently created a custom component that will replace the title attribute of the kudos counter with a list of users who clicked the button. I did this because it was frustrating to our users to have to click the button to view a list of users who clicked the kudos button. This is a two part component - one component is added to the forum message quilt right next to your message kudos component, the other exists on the forum topic page (where you see a list of posts) and this is just some javascript that will take the data and clone it into the title attribute of the kudos element. This is a working example and you are free to take my code and do whatever you want to it. Component 1 - getting the data for each post (place this next to the kudos button in your quilt) <#assign messageId = env.context.message.uniqueId /> <#if messageId?? && messageId gt 0> <#assign cutoff = 10 /> <#assign counter = 0 /> <#assign users = rest("/messages/id/${messageId}/kudos/givers?page_size=${cutoff}").users /> <#assign kudosCount = rest("/messages/id/${messageId}/kudos/count").value /> <#assign remaining = kudosCount?number - cutoff?number /> <#if users??> <#if kudosCount?number gte 1 ><span class="kudosgivers hidden">${kudosCount} <#if kudosCount?number == 1>user<#else>users</#if> liked/thanked this post: <#list users.user as kudosGiver><#assign counter = counter+1 />${kudosGiver.login}<#if counter?number == cutoff?number && kudosCount?number gte cutoff?number+1>... and ${remaining} other <#if remaining == 1> user<#else>users</#if>. <#else><#if counter?number == kudosCount?number>. <#else>, </#if></#if></#list> <#if kudosCount?number gte cutoff?number+1 >Click the number to view who else liked/thanked this post.</#if></span> </#if> </#if> </#if> Component 2 - using javascript to clone the data and replace the title attribute (place this somewhere in your forum topic quilt) <@liaAddScript> ;(function($) { $(".kudosgivers").each(function() { var $kudosgivers = $(this); $kudosgivers.parent().find('.kudos-count-link').attr('title', $kudosgivers.text()); $(this).remove(); }); })(LITHIUM.jQuery); </@liaAddScript> Make sure that you have the '.hidden' CSS (display: none;) so that it hides the span containing the data as it will be displayed on pageload before the javascript destroys the element - also if for any reason a user has javascript turned off it will still keep the element hidden from view. Feel free to change it to whatever you would like it to do - you don't need to use the javascript if you want to display the users somewhere in a message. Hope you find this useful!jaread839 years agoChampion76Views1like0CommentsHow to tell if the requested node exists?
Im trying to add a function to my common.init that is basically <#if node exists > do stuff </#if> I tried the following but no luck. <#if !coreNode> <#if !coreNode.id> <#if !coreNode.ancestors> <#if page.name == "ErrorPage"> but none of them actually run their contents on a nonexistant node. Is there a way to check if the requested node exists?103Views0likes1CommentMarkup classifications for Options links
Hi, we've enabled the Google Tag Manager link tracking for our community and unfortunately the link tracking produced a java script error for the options drop down on the thread page. Hence, we'd like to exclude the options links from the link tracking and thus it would be great if we could have all the classifcation names for the option links. For example, subscribing to the RSS feed has the following classification:"lia-link-navigation rss-board-link lia-component-rss-action-board" . Can anyone provide this overview? KR, Estheresther279 years agoAdept59Views0likes0CommentsCustom component to show who Kudoed a post
I am building a custom component that will list all users who clicked the kudo button on every post. All was going well until I needed to cut off the amount to display and show a message to say to that the user needs to click the link to view the rest. Basically, this is what I am trying to acheive... get the post message unique ID assign a cutoff number (10 in my case) get the rest to give me a list of users who clicked kudos button on this message using page_size with my cutoff number assign a variable to give the total number of kudos for my message once all the above has been set, show a 'XX users kudoed this post' Then loop through the user list and display the usernames If the amount of kudos exceeds my cut off, display a message 'Click here to view who else kudoed this post' (this is where the issue occurs). So the problem is that when comparing the cutoff number with the kudoscount variable, it says I can't compare these two numbers. I am not sure exactly how to fix this... I am sure it would be pretty simple though! Here is my code: <#assign messageId = env.context.message.uniqueId /> <#if messageId?? && messageId gt 0> <#assign cutoff = 10 /> <#assign users = rest("/messages/id/${messageId}/kudos/givers?page_size=${cutoff}").users /> <#assign kudosCount = rest("/messages/id/${messageId}/kudos/count").value /> <#if users??> ${kudosCount} users kudoed this post<br> <#list users.user as kudosGiver> ${kudosGiver.login}<br> </#list> <#if kudosCount gte cutoff > Click here to view who else kudoed this post. </#if> </#if> </#if> Any help would be greatly appreciated. Thanks!jaread839 years agoChampion131Views0likes2CommentsSend Notification Email To Mentioned User
Hi I want to create a module through which I want to send an email notification to the user that has been mentioned in the reply. Is there any rest API through which I can achieve this functionality. Please suggest for the same. Thanks.him_varma9 years agoAdvisor154Views0likes4CommentsSkip metrics created by Machine user in the community
Hi, We are using a machine user which creates posts (TKB) in some hidden boards by fetching post content from third party. But this machine user (since it is creating many posts) is significantly effecting the Lithium Social Intelligence analytics, metrics for superusers, casual users, observers. and CHI scores about the community.. We have read the article about “Skip post metrics”, will this solution solves our problem? If yes, is there any way we can apply this solution for specific boards? Please guide us the right approach to solve the issue. Thanks & Regards, Phaniphani9 years agoAdvisor53Views0likes0CommentsPrint Knowledge Base
Hi, Can we disablePrint Knowledge Base option in the Community. Regards, Abhishek IllindraSolved106Views0likes1CommentReplicate Topics I've participated in
I'm trying to replicate this component from the profile page, so I can adjust some settings. Problem is, the component sorts on conversation.last_post_date and I can't SORT BY that field when using "SELECT DISTINCT topic.id FROM messages WHERE author.id = '<user-id>'" using the API. If I try "SORT BY post_date" they obviously don't sort properly. I assume there's a easier way than pulling ALL the topics and then sorting them by last_post_date? Has anyone figured this out?50Views0likes0Commentsneed help with Bulk API for C#
Here is what i built based on curl example: var httpWebRequest = (HttpWebRequest)WebRequest.Create("URL here"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Accept = "*/*"; httpWebRequest.Method = "GET"; string credentials = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; httpWebRequest.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(credentials))); httpWebRequest.Headers.Add("client-id", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx="); httpWebRequest.Headers.Add("Keep-Alive", "true"); httpWebRequest.KeepAlive = true; httpWebRequest.ContentType= "text/csv"; var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); This keeps failing... what am i doing wrong here?anujabbi9 years agoContributor100Views0likes0Commentsbase skin css get warnings from CSSLint
It has been the issue ever since the very beginning. if some CSS validation tool ,like CSSLint is used, It will throw warnings again the base skin style, for example : CSSLint Warning Don't use adjoining classes .at line 10 col 68 CSSLint Warning Don't use IDs in selectors .at line 10 col 1 I was wondering if this issue should be brought into any attentions.59Views0likes0CommentsDocumentation for coreNode.permissions.hasPermission
I remember finding some documentation oncoreNode.permissions.hasPermission, but I cant find it anymore. Anyone know where this went? I understand that this might still be "experimental." Nevertheless its a method we use, and I would like to understand it better.Solved124Views0likes2CommentsSearch your PMs
Hi there. I just made this component that lets you search your Private Messages. Thought I'd share it. Maybe someone wants to use or see if they can streamline it. I've made it search max 500 records. Obviously you can make that less, or add some code to let users search more than just the first page. You should just be able to plug it into a custom component on any page. Username is case insensitive. Start date I automatically insert the date the Spotify community started. End date should always automatically show today(). Have fun with it. <form> <div class="lia-panel lia-panel-standard lia-component-pm-search"> <div class="lia-decoration-border"> <div class="lia-decoration-border-top"> <div></div> </div> <div class="lia-decoration-border-content"> <div> <div class="lia-panel-heading-bar-wrapper"> <div class="lia-panel-heading-bar"><span class="lia-panel-heading-bar-title">Search PMs</span></div> </div> <div class="lia-panel-content-wrapper"> <div class="lia-panel-content"> <div> Search my <select id="InOrOut" onChange="FuncToFrom();" class="lia-search-form-granularity"><option>inbox</option><option>outbox</option></select> for PMs <span id="FromTo">from</span> <input type="text" id="UserLookup" class="lia-form-type-text search-input lia-search-input-message"/> between <input type="text" id="SearchDateStart" class="lia-form-type-text search-input lia-search-input-message" value="2012-02-08"/> and <input type="text" id="SearchDateEnd" class="lia-form-type-text search-input lia-search-input-message" value=""/> <input type="button" value="Go!" onClick="LookUpUserPM();" class="lia-button lia-button-secondary lia-button-searchForm-action"/> </div> <div id="PMs"></div> </div> </div> </div> </div> </div> </div> </form> <script> var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! var yyyy = today.getFullYear(); if(dd<10) {dd='0'+dd} if(mm<10) {mm='0'+mm} vToday = yyyy+'-'+mm+'-'+dd; $(document).ready(function () { $("#SearchDateEnd").val(vToday); }); function FuncToFrom() { var vInOut = $("#InOrOut").val(); if (vInOut == 'inbox') { vLookin = 'from' ;} if (vInOut == 'outbox') { vLookin = 'to' ;} $("#FromTo").html(vLookin); } function LookUpUserPM() { FuncToFrom(); var vInOut = $("#InOrOut").val(); $("#PMs").html('Thinking...'); if ($("#SearchDateStart").val() == '' || $("#SearchDateStart").val() == 'YYYY-MM-DD') { vDateSearchStart = 0; } else { vDateSearchStart = new Date($("#SearchDateStart").val()); } if ($("#SearchDateEnd").val() == '' || $("#SearchDateEnd").val() == 'YYYY-MM-DD') { vDateSearchEnd = 10000000000000; } else { vDateSearchEnd = new Date($("#SearchDateEnd").val()); } $.get("/restapi/vc/users/id/${user.id}/mailbox/notes/" + vInOut + "/?page_size=500&page=1&restapi.response_style=view", {}, function (xml) { vText = ''; vTotalNotes = 0; $('note', xml).each(function (i) { vTotalNotes += 1; var vFromTo = $(this).find(vLookin).find('login').text(); var vFromTo2 = vFromTo.toLowerCase(); if ($("#UserLookup").val() == '') { vDate = $(this).find('sent_time').text(); vDateNew = new Date(vDate.substr(0,vDate.indexOf("T"))); vSubject = $(this).find('subject').text(); vNoteId = $(this).find('id').text(); if ( vDateSearchEnd >= vDateNew && vDateSearchStart <= vDateNew ) { vText += vLookin.charAt(0).toUpperCase() + vLookin.slice(1) + ': ' + vFromTo + ', Sent: ' + vDate + ', Subject: <a style="color:#7ab800 !important\;" href="/t5/notes/privatenotespage/tab/' + vInOut + '/note-id/' + vNoteId + '/notes-view-mode/single" target="_new">'+ vSubject + '</a><br/>'; } } else if ( vFromTo2 == $("#UserLookup").val().toLowerCase()) { vDate = $(this).find('sent_time').text(); vDateNew = new Date(vDate.substr(0,vDate.indexOf("T"))); vSubject = $(this).find('subject').text(); vNoteId = $(this).find('id').text(); if ( vDateSearchEnd >= vDateNew && vDateSearchStart <= vDateNew ) { vText += vLookin.charAt(0).toUpperCase() + vLookin.slice(1) + ': ' + vFromTo + ', Sent: ' + vDate + ', Subject: <a style="color:#7ab800 !important\;" href="/t5/notes/privatenotespage/tab/' + vInOut + '/note-id/' + vNoteId + '/notes-view-mode/single" target="_new">'+ vSubject + '</a><br/>'; } } }); if (vText != '') { $("#PMs").html(vText);} if ($("#PMs").text() == 'Thinking...') { $("#PMs").text('I searched ' + vTotalNotes + ' records, but didn\'t find anything. Sorry :/'); } }); } </script>257Views17likes1CommentHelp with API time
I am trying to get some daily metrics using the API using calls similar to this: Communiry/metrics/name/metric/history/daily?date_start=2016-05-01&date_end=2016-05-02. Looking at the data it appears that the numbers returned are based on the start and end of a day in the pacific time zone. The default/ chosen community time for the user making the call are both central. Also, since LSI gives numbers back in UTC time, these are not uniform, and throw our numbers off a little. I tried changing the time zone for the user making the call, and it does not seem to change API time settings. Is there a way we could either change our time setting to Central, or to match LSI and do UTC?jordanepotter9 years agoMentor243Views0likes4CommentsCustom Endpoint: Update user settings/profile data
Hello! I'm new to the Freemarker language and somewhat new to Lithium. I'm trying to create a custom endpoint that takes parameters from a call from a Java service and uses them to update a user's profile. So far I have tried to update the email address with no luck. I'm getting a 500 error when calling this endpoint. Here's what I have so far: <#include "common-vars.ftl"/> <#attempt> <#assign username = http.request.parameters.name.get("username")/> <#recover><#assign username = ""/> </#attempt> <#attempt> <#assign firstName = http.request.parameters.name.get("firstName")/> <#recover><#assign firstName = ""/> </#attempt> <#attempt> <#assign lastName = http.request.parameters.name.get("lastName")/> <#recover><#assign lastName = ""/> </#attempt> <#attempt> <#assign email = http.request.parameters.name.get("email")/> <#recover><#assign email = ""/> </#attempt> <#attempt> <#assign aboutMe = http.request.parameters.name.get("aboutMe")/> <#recover><#assign aboutMe = ""/> </#attempt> <#attempt> <#assign avatar = http.request.parameters.name.get("avatar")/> <#recover><#assign avatar = ""/> </#attempt> <#attempt> <#assign userIdQry = "SELECT id from users where login = '${username}'"/> <#assign userId = executeLiQLQuery(userIdQry)/> <#recover><#assign userId = ""/> </#attempt> <#function updateEmail username email> <#return (rest("/restapi/vc/users/login/" + username + "/email/set/" + email))/> </#function> <#attempt> ${restadmin("/restapi/vc/users/login/" + ${username} + "/email/set/" + ${email}} <#recover>There was an error updating email. </#attempt> As you can see from the code, there are a few other fields that we would like to update via this endpoint. Thank you for your help! EDIT: If there is a way to use API v2 to update multiple fields with one call, that would be extremely helpful!Solved580Views0likes6CommentsPass a random token to an endpoint
Hi everyone. I'm thinking about adding some security to some of my custom components. I think I could do this by generating a random token on page load and checking against this token on the endpoint I call. I'd pass the original token through the url, but how do I also pass this token safely to the endpoint, so it can compare the two? Is the only way through a temporary cookie? Does the Lithium platform have some buil-in code I can employ instead? Thanks.64Views0likes1CommentTrying to fetch the user metrics by using v2 api call.
Hi, By using v1 api call we are able to get user full metrics details. Following api call (/users/id/${user id}/metrics). But we are unable to get same details using v2 api call (SELECT * FROM metrics WHERE user.id = '${user id}'). Kindly suggest the right api call. Thanks, Chinni.kckmurthy9 years agoContributor202Views0likes6CommentsRetrieving message body (or snippet) through API V1
So, I am trying to mimic the results of our online search using API calls. Currently, I am making an API V1 call to query for the top 5posts. I would also like to list a snippet from the message body below each link. (A brief 2-line summary similar to what is done in the online search.) Is this possible? If so, what would be the easiest way to accomplish this?tmosher9 years agoContributor103Views0likes1CommentLiQL injection attacks and quotes in Rest API 2.0
I am sorry if this subject has already been covered, but I have searched forums, knowledge bases and Google for any answers and have come up empty handed. I am wondering how LiQL is protected against: LiQL injection attacks (when query parameters contain user-entered data) like SQL Injection attacks. LiQL handling of query parameters that contain single quotes. Example (made up): <#assign replies = rest("2.0","/search?q=" + "SELECT id, body FROM messages WHERE topic.tag = '${topic_tag}' AND depth > 0"?url).data.items /> If the variable topic_tag comes from a user-entered value, and it itself contains a single quote ['], the rest query string will have unmatched quotes, and would probably cause the query to fail. <#assign topic_tag = "don't_do_this" /> ... would cause the query to be ... "/search?q=SELECT id, body FROM messages WHERE topic.tag = 'don't_do_this' AND depth > 0" The part of the query colored red would surely upset the query parser, right? Shouldn't variables that are expanded into LiQL be escaped to prevent this from ever happening?hattesen9 years agoAdept359Views1like8CommentsUnable to see SASS files under Custom Skin
Hi, I was trying to setup a custom skin based on tutorial herehttp://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=responsive#l%3A%3A%7B%22p%22%3A%22%2Fsection-customize.html%22%7D. Everything is good but I do not see mentioned SASS files in my directory structurefor e.g. _variables.scss. All I see is MySkin > desktop.Not sureif I am doing something wrong. Any help is appreciated. Thanks Ankurankurarora9 years agoContributor139Views0likes2Comments