REST API search messages by Metadata
Hi, The GET message by metadata is not working suddenly, it was working fine till yesterday. In lithium api browser its returning data for the same metadata query. Lithium - API Browser – Returning Data select * from messages where c_cust_id='test - 321' API Call from Our application url1 : https://test.abc.com/api/2.0/search?q=select+%2A+from+messages+where+c_cust_id%3D%27Test+-+321%27 url2 : https://test.abc.com/restapi/vc/search/messages?q=custom.id:'Test - 321' Headers : Content-Type - application/json client-id - VvhCplkjSJLJLKAkjakHLlkjALjgSLkhkjkSLKHLSasktrreyale1I= response : {"status":"success","message":"","http_code":200,"data":{"type":"messages","list_item_type":"message","size":0,"items":[]},"metadata":{}}nrajesh7 years agoGuide185Views1like1Commentusercache: where's the earliest place I can usercache.put? Page Init doesn't seem to work.
I have a test to do on user roles and groups that I'd like to do as early as possible on page load, and keep it in the cache. (i.e., what private groups are they allowed access to). Right now I'm using LiQLlike so: SELECT count(*) FROM categories WHERE depth = 2 and parent_category.id = 'private-support' This results in all the privatecategoriesthey have access to, usually one. Within those, there are either Discussion, Ideas, a TKB, or Just a Lithium group Case 1: continue to the Category (i.e., ClientName Private Support) Case 2: If it's just the group I am redirecting the page to the actual group rather than the parent category containing it, for user simplicity. This is why it's in page init, so the redirect can happen on server side before anyHTML is written Since I'm running the query there, I'd like to be able to use usercache.put in the page init to keep that for other components to use rather than repeat the queries, but it doesn't seem to work. Is that by design? A bug? If it's not permissible in page init, where else can I put that query so that it happens as early as possible?SolvedInactive User7 years ago322Views0likes10CommentsHow to change the TKB article listing
Hi all, My plan is to change the default 'tkb.widget.article-list' . i just want to list the title and modified date and not displaying it in grid. Rather than create a new custom component for that, maybe i can change the OOB component . Any idea on how to get it done? I've tried to create a custom component but stuck on creating the paging for that list. Default : Custom : Thanks in advance.Solvedcicibo7 years agoContributor313Views0likes7CommentsIs there any way to show users Firstname and Lastname in place of USERNAME all over the community
Is there any way to show users Firstname and Lastname in place of USERNAME all over the community. We don't want to show users USERNAME in the community and we want to replace or change it to show users Firstname and Lastname from there profile in every place where username is showing.124Views1like1CommentHow do I subscribe and unsubscribe to a label using API?
Hi Folks, I am creating a new page called "My Interests" page which has a list of all the labels I am subscribed to. I also want to allow users to subscribe to the label from that page. Is there a REST API I can use to achieve this? I could not find anything specific underhttps://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv1 Thanksgstelang7 years agoMentor328Views2likes7CommentsSubscription REST call fails as admin
I'm creating a custom component for a subscribe button. The button needs to exist on a QandAQuestionPage and subscribe users to topic changes (side note: still unclear on thread vs message subscriptions - there seems to be no documentation on the difference). The button needs to do the following on page load: For anonymous users, add disabled class to button For logged in users, check if a subscription already exists If so, assign custom text to the button i.e. "unsubscribe" and assign click event to unsubscribe from thread If not subscribed, button will have the text "subscribe" and click event will subscribe the user I run into problems when I try and add a subscription. Here is the roughcode: <#assign message = page.context.thread.topicMessage! /> <#assign topicId = message.uniqueId! /> <#assign subscription = rest("/threads/id/${topicId!}/subscriptions/users/self/type/email").subscription[0]!/> <#assign userIsAnonymous = user.anonymous! /> <#assign buttonStateClass = "button-default" /> <#assign buttonText = text.format("label.subscribe_to_label") /> <#assign buttonSubscribeAction = "add" /> <#--Check user logged in state and subscription status--> <#if userIsAnonymous!> <#assign buttonStateClass = "button-disabled" /> <#else> <#if !subscription.@null??> <#assign buttonStateClass = "button-active" /> <#assign buttonText = text.format("label.custom.subscribed_to_label") /> <#assign buttonSubscribeAction = "remove" /> </#if> </#if> <button id="watch-topic-button" class="${buttonStateClass!}" data-action="${buttonSubscribeAction!}">${buttonText!}</button> <@liaAddScript> ;(function($) { $(function() { $("#watch-topic-button").on("click", function () { var action = $(this).data("action"); post(action); }); function post(action) { $.post("/restapi/vc/threads/id/"+${topicId}+"/subscriptions/users/self/"+action+"?subscription.type=email", function(data){ console.log("success?: ", action, data); }); } }); })(LITHIUM.jQuery); </@liaAddScript> Checking the subscription is successful, but adding a subscription results in a Error.. in the XML response is an error code 303. When I try to hit the URL directly I get a 504 error "Method 'get' is not supported off of node 'thread_subscription_context.users.self.add'" I was looking at code from discussions like: https://community.lithium.com/t5/Developers-Discussion/I-need-a-way-to-add-a-subription-to-a-board-for-many-users-at/m-p/171651#M6837 I'm an admin user and copied this code from discussions here. Any ideas? Is there a better way to do this? Thanksttadej7 years agoAdvisor276Views0likes5Commentsquestion about automation with Bulk API
Hello developers, I would like to ask the community on a particular issue with handling bulk api calls. We are trying to retrieve the bulk api data via an automation but I am hitting a wall in setting it up. So far this is themethod I am trying to work on: 1. Setup the task manager // chron to call a .jar file 2. Said .jar file runs "onload" call to run the java script with the curl command. 3. After the script is called resulting data goes to reserved folder. This is a bit crude and I am not making any head ways in the project. Could anyone tell me on how to properly set this automation call? Thank you, JKMach0087 years agoGuide88Views1like1CommentCan we have 2 POST calls in an endpoint?
Hi, I'm calling an url of POST type in an endpoint with different twice. But the response we are getting is of only one post call, that is the first one. For example: <#attempt> <#assign imageURL = http.client.request("https://comunity.com/v1/pop/avatars/image").header("Ocp-Apim-Subscription-Key","key").body('${requestBody}',"application/json").post() /> <#if imageURL.hasError> <error>${imageURL.error.message}</error> <error>${imageURL}</error> <error>${imageURL.error}</error> <#else> <#if imageURL.content??> <#assign res=imageURL.content?eval /> <#assign url = res.url /> ${url} </#if> </#if> <#recover> Error </#attempt> ${parts_array[1]} <#attempt> <#assign imageURL1 = http.client.request("https://community.com/v1/pop/avatars/image").header("Ocp-Apim-Subscription-Key","key").body('${requestBody1}',"application/json").post() /> <#if imageURL1.hasError> <error>${imageURL1.error.message}</error> <error>${imageURL1}</error> <error>${imageURL1.error}</error> <#else> <#if imageURL1.content??> <#assign res1=imageURL1.content?eval /> <#assign url1 = res1.url /> ${url1} </#if> </#if> <#recover> Error </#attempt> Could anyone help me with this? Thanks126Views1like2CommentsOnline users API call - what order are these results?
Hi all, I am using the API V1 call for online and registered users on a custom component: <#assign users = rest("/users/online/registered?page_size=100").users /> I was wondering... how are these results ordered? I can't seem to find any clear indication of the order of the online users here. If the order is not determined... how can I tell the API call to order them in a way that I wanted (like last visit time for example).Solvedjaread837 years agoChampion386Views0likes10CommentsDifferent results for SELECT count(*) and SELECT * ... list size
Hi guys, I'm a bit confused using APIv2, during some inconsistent results. I execute the following queries to build a custom component and I already tested the query in Studio's API Browser: SELECT count(*) FROM messages WHERE board.id = 'tech-experts-blog' AND depth = 0 AND labels.text IN ('Sicherheit') SELECT * FROM messages WHERE board.id = 'tech-experts-blog' AND depth = 0 AND labels.text IN ('Sicherheit') The first query (selecting the count) returns a list sizeof 8, whereas the second query returns only a list size of 7. The default labelwidget shows the correct count for each label (7 in this case). Does anyone have any idea where these difference is coming from? Could it be a bug in Lihtium's API or a data issue? Best regards, Christiancike7 years agoChampion176Views1like3CommentsAPI Newbie - OAuth 2.0 "Internal Server Error" StatusCode 500
Hi everyone, First - I am abrand new API user and doing my best to learn as much as possible, but am getting stuck. I've been trying to follow the great suggestions made on this threadbut seem to keep hitting errors. I think I am running into the issue during the OAuth2.0 process, but have provided all my steps just in case I am doing something wrong before this step. Any help/advice you can give a non-programmer data analyst like me would be SO appreciated!! Thank you in advance! Kate --- End Goal: To perform a regular XML or JSON export of our forums data from the messages, user, and several associated tables to be incorporated into an on-premise business intelligence solution to allow by topic focused reporting. Steps Taken so Far: 1) Determined fields needed and data type availability etc. via APIv2 documentation 2) Gained access to our site's stage environment to test LiQL queries via the Studio>API Browser tab. Created a successful test query (example -SELECT * FROM messages WHERE id = "17478") 3) Gained access to stage environment Admin to navigate to API Apps and create a new web app where display name= Test, Authorization Redirect URL = forums.stage.[ourcommunity].com 4) Via new Web API App, noted Tenant ID, Client ID and Client Secret 5) Try an unauthenticated test call via Postman usinghttps://api.stage.lithium.com/community/2.0/[tennantID]/search?q=SELECT+*+FROM+messages+WHERE+id%3D"17478"&api.pretty_print=true 6) Received error message 401 "Invalid Access Token. Please refresh the token" 5) Try to complete OAuth2.0 to get a valid access Token: a) Submit URL https://forums.stage.[ourcommunity].com/auth/oauth2/authorize?/clientid=[exact_client_id_shown_in_Web_API_App]&response_type&redirect_uri=forums.stage.[ourcommunity].com b) Receive a "The page you are trying to access was not found. Please check your URL for typos and try again" in browser with following URLhttps://forums.stage.[mycommunity].com/t5/oauth/forums.stage.[mycommunity].com?code=[encoded_string]&user-id=125&tenant-id=[my_tenant_id]&proxy-host=api.stage.lithium.com c) Using HTTPRequester in my Firefox browser (couldn't get the flow this far w/ Postman) pass a POST request forhttps://api.stage.lithium.com/auth/v1/accessToken with the following in header: client_id: [exactly as found on my API Web Apps] content-type: "application/json" client_secret: [exactly as found on my API Web Apps] code: [exactly as found in URL in step b] Redirect_uri: "forums.stage.[mycommunity].com grant_type: authorization_code And here is where I keep getting stuck.... Result: {"status":"Internal Server Error","message":"Internal Server Error","statusCode":500} Any ideas?khill7 years agoMentor309Views0likes5CommentsMobile view
Hi, I just need a help, and i'm facing issues like, while accessing the website in mobile, the mobile design not getting rendered, and i'm getting desktop view instead of mobile view. In our community site, we have "View all" link in the "Latest topic" block. The URL is like /t5/forums/recentpostspage/post-type/thread. So when we click the link, respective clicked page is getting changed from mobile view into desktop view. I recognize that, while access the site in mobile device in footer Version: Full | Mobile is displays. But in my issue page not showing this option in the bottom. Could you please guide me, 1) The respective forums "View all" mobile layout not available, so that it i'm getting the desktop view? 2) If my assumption is correct, then how can we create page layout for this URL type?Solvedjaikumar17 years agoMentor254Views0likes6CommentsAutoquote in PMs
Hi, Following on from this thread:http://lithosphere.lithium.com/t5/Product-Support-Board/How-can-I-work-with-my-PMs-more-effectively/m-p/41006 I have created the component and added it to the "Private Notes Page". However, when a user now uses the PM system, upon loading the quote it doesnt break it clear of the curser. So when a user starts typing their message it appears as part of the quote. WHen a user presses enter it either removes the bottom quote line or moves it down the page. The only way to keep the text outside of the quote is to click on the bottom line of the quote and press the down key - this seems to break it clear of the "blockquote". Upon comparing the HTML for the blockquote with a normal message and this PM it would seem it is not including a < p > < /p > at the end of the blockquote. I followed the instructions to the letter and made no changes to the component code supplied. Does anyone have any ideas? Thanks, GreggSolvedgregg7 years agoMentor231Views0likes3Comments"Accepted solution" not floated for sorting order "newest first"
We have enable setting 'floated accepted solution and 'Float Accepted Solutions on the top of threads' from admin. If we sort the accepted solution post by "newest first" then accepted solution block will disappear and its working fine for other sorting.Your help could be appreciated. ThanksSolvedashinde7 years agoGuide184Views2likes3Commentsnumber format
Hi, For number 1000, US is using 1,000 and EU is using 1.000 In freemarker, we can do things like${count?string(",##0")} for US But, I want to format the number based on user's language settings. Is there a Lithium built-in function to format the number based on the user language setting? eg. ${utils.numbers.some_format_function($count)} PeterSolvedpeterlu7 years agoChampion167Views1like2CommentsAdvanced search is not working
Hi, We are using advanced search. If we search the post (example - test) and applied advanced search(search for exact string forexample -test 12) on search result(example-test) then not getting exact search result instead it return all the result(example -test).Your help could be appreciated. Thanksashinde7 years agoGuide137Views0likes1CommentHow to get count of tags created
I want to get the tags created in a specific period. I have used below the call to get the data. https://community.lithium.com/restapi/vc/metrics/name/tagging_tag_count?date_start=2017-09-01T00:00:00&date_end=2017-09-30T23:59:59&restapi.response_format=json&restapi.session_key=ZjpA8miYNoDXSenJ2wlOlSLeJE0aX0XnH2yAI4fsOFY. But it's returning"Permission Denied". So what permission needs to be granted in admin panel to access this API?180Views0likes4Comments414 Request-URI Too Long
Hey all, After completing a customisation with the very helpful VikasB over on this thread https://community.lithium.com/t5/Developer-Discussion/Post-a-new-topic-to-a-specific-board-via-API/m-p/324909#M12683 I have since put my code live and the users are making good use of it. Well.. almost too much use of it as they immediately started trying to report the type of posts that were very lengthy in its content. I took a look at the console in my dev tools and found the following error: NetworkError: 414 Request-URI Too Long and the response from the header is Request-URI Too Long The requested URL's length exceeds the capacity limit for this server. Is there a way around this? The api docs say that the limit is 1,000,000 characters which is plenty of room so not sure why this would happen. Do I need to limit the api call or convert it to a V2 api? Not sure what to do with it :( Thanks, JackSolvedjaread837 years agoChampion150Views1like2CommentsPost a new topic to a specific board via API
Hi all, Is it possible to post a new topic with a subject and body content into a specific board via the API? I would like the user who initialises the api call to be the author of the new topic too. I am having trouble finding anything other than viewing or editting existing content. Cheers, JackSolvedjaread837 years agoChampion483Views1like15CommentsPeriod in query breaks query
Hi everyone, wondering if anyone else has come across this. I run this query and it works fine in API Browser, but in a community component it says the query is null: "SELECT id FROM messages WHERE board.id = 'starkb' AND subject MATCHES 'Twitter Starbase 1.0'" If Icut offthe ".0" it works. Seems to be the period. In this case I could query without the last two characters, but long term that could get me the wrong message, depending on where the period shows up. Any way to work around or fix that period problem?349Views0likes9CommentsCant differentiate between Answer and Comment to Question
Hi, i asked a question in the support board today: http://community.lithium.com/t5/Support-board/Cant-differentiate-between-Answer-and-Comment-to-Question/td-p/189359 And KriS suggested i asked for a workaround here. Please see the detailed description in the referenced Suppord-Board. Here is the summary: Question an Answer Thread: The Question has one answer and one comment. As far as I can see it, there is no way of finding out which one is the comment and which one is the answer via the api. The responses look very much alike... Does anybody have a workaround for this issue? Thanks!big7 years agoAdept379Views0likes11CommentsUser profile statistics component posts
Hi, User profile statistics component displays incorrect number of posts. For example, component shows 20 posts but when i open the link, the page contains only 1 post. Is there any way i can make the component display actual number of posts. Thanksshravani7 years agoGuide197Views0likes6CommentsPosts count result shown wrong on Search page
Hi, I'm facing this issue of incorrect search result posts count on the Search Page. For example the count shows 4 results but the actual posts shown are only 2. And second image shows that there are 36 results but on pagination page 3, there are no results. Could anyone help me with this issue. Thanks103Views0likes2CommentsResponsive website
Hi, I need to understand, how we need to develop the responsive website? As we have community site already, and we want the site in responsive. So i want to know, what needs to do regards the responsive site? I also have few question, Lithium provides any responsive design by default ? If yes, then how can we get the responsive design? If suppose to design responsive design from scratch, then what needs to be done without affecting the existing website design? What are all pages, layouts and components need to upgrade from default into responsive design?jaikumar17 years agoMentor442Views0likes12CommentsIs there any way to add unique/hidden field to message from REST API
Hi, Am posting messages in particular board from REST API. Messages might have same SUBJECT line (can post from Application / REST API), from these how can i identify which one is created from REST API. Is there any field to find it. Or can we set any customized field, if yes please tell me how to do it.nrajesh7 years agoGuide212Views0likes4CommentsCustomize Accepted Solution - banner
Hello everyone, I am trying to customize the accepted solution for my community, but needs some help getting it setup. This is what I am going for: Ifpost is a solution, we would like to have a highly visible banner on top. Can anyone give me some pointers in setting this up? Thank you,SolvedMach0087 years agoGuide190Views1like2CommentsChrome 62 - October SSL Changes
Hi All, Thought I would share this with you to give a heads up, it appears Chrome 62 will be shipping in October and we received notice from Google that unless your site uses SSL for all pages it'll start showing warnings to users that the site is insecure whenever they enter data (for example into the search field). This is part of Google's push to move all sites to adopt HTTPS and future versions of Chrome will block access to non HTTPS sites by default. More info from Googleon their blog articleNext steps toward more connection security We got notice that our community which we have partial HTTPS enabled on will be affected unless we switch over to HTTPS, we've held off as switching fully over breaks some of the SDK functionality around skin development through the li serve-sass function, but we cannot hold off any longer. On the SDK side, I'm looking at workarounds for the loss of local skin compilation as this was a great timesaver in our workflow. Unfortunately the old workaroudn of enabling mixed/insecure content in browser settings appears to be getting phased out, we can no longer use this option in Safari so that breaks our testing/workflow for that browser and iOS devices and I suspect Google may eventually do the same. Has anyone managed to successfully workaround using li serve-sass in the SDK with HTTPS enabled fully on the community?225Views2likes2CommentsUpload multiple attachment using REST API V1
I am using message/post API to post a message. Below are the params which I am passing while creating a new message. I am using PHP curl for this. Below is my code which is working fine for single attachment.However, I don't know how can I upload multiple attachments. $param = array( 'message.subject' => 'Message Subject', 'message.body' => 'Message Body', 'message.upload' => 'C:\xampp\htdocs\dd\test.jpg' ); $cFile = curl_file_create($param["message.upload"]); $param["message.upload"] = $cFile; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$this->curl_url); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $param); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_VERBOSE, true); $result = curl_exec($ch);HiteshKumar7 years agoExpert101Views1like0CommentsHow to embed Lithium Search component and Widget in an external Web property
Greetings, Can someone point me to the discussion or documentation to reproduce the Lithium Search component in an external web property as it exists in the Community today. Additionally interested in blending this with another platform KB to optimized results from a number of sources. Thanks! DaniDani8 years agoAdvisor115Views0likes1Commenthow to get languages supported on my current instance?
Hi, I want to create a custom language drop-down for anonymous user. How do I fetch all the languages supported/added in current instance. Note : I do not want to get languages supported by Lithium platform, I just want those languages added on the specific instance. Any pointers? Thanks, Vaishnavivaishnavi8 years agoExpert196Views0likes4CommentsReply Message - REST API
Hi, I tried below given 2 methods for REPLY to the message, but none of these working. Anyonehelp me out from this, i have missed anything or another ways are there to REPLY to the message in the board. This method is creating new message not replying to the mentioned parent. Method : POST URL : https://api.stage.lithium.com/community/2.0/tenant_id/messages Headers : Content-Type - application/json client-id - JJHJHKJHKHJKLJLJLKJKJLJKJJLJL= Authorization - Bearer HJHJHJHJHJHJHJHJHJJH= Data : { "data": { "type": "message", "subject": "hello world", "body": "this is a message post.", "board": { "id": "kzkzkzkzkzkz" }, "parent":"123456" } } This method is throwing error. Method : POST URL : http://community_name/restapi/vc/messages/id/123456/reply Headers : Content-Type - application/json client-id -JJHJHKJHKHJKLJLJLKJKJLJKJJLJL= Authorization - BearerHJHJHJHJHJHJHJHJHJJH= Data : { "data": { "type": "message", "subject": "hello world", "body": "this is a message post.", "board": { "id": "kzkzkzkzkzkz" } } Reponse: Unauthorized This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.nrajesh8 years agoGuide147Views0likes2CommentsSMM Bot API
Hi, I am pretty new to the lithium development. I am trying to leverage the new Bot API to integrate our Facebook messenger Bot withthe Lithium response. I was able to register the Bot by providing the required parameters. But when I tried the hand off API with the registered externalId and PSID details, I am getting a 404 error with the following message: { "status": "fail", "message": "Failed to find bot conversation" } Appreciate help fromanyone who has workedwith the Bot API or experienced similar issues before. Thanks, Sunita Dorasunidevtest8 years agoContributor193Views0likes1CommentMethod to Extract the "Detailed Description" Field Contents Via an API Call?
The "Detailed Description" field (in the node properties for boards and blogs (at least) is only exposed to the on-page component "Node Detailed Description". The content of this field does not generate a named text string. I do not want the component on my pages, but just want to extract the content of the field in the Properties sheet. Since it's not a named text string, is there an alternate method to extract that content? What I would like to do ultimately is to use this for the metadata Description, instead of what is placed on the page. SEO requirements generally lead to entirely different content than on-page sub-heading ("Description") text.98Views0likes1Comment