How to add tags to a wiki page in IBM Connections without deleting the page content - wiki

I am trying to add tags to an existing wiki page in IBM Connections.
If I implement a POST call according to API documentation, the tags are added correctly but the content of the wiki page is cleared.
Here is the format of my POST command:
Set oHttp = CreateObject("MSXML2.XMLHTTP")
sUrl = "https://my-connect-server/wikis/basic/api/wiki/%WIKIID%/page/%PAGEID%/entry?tag=%TAG%"
Call oHttp.Open("POST", sUrl, False)
Call oHttp.setRequestHeader("X-Method-Override", "PUT")
Call oHttp.send
Of course %WIKIID%, %PAGEID% and %TAG% are replaced with valid values.
How do I need to modify this call so that only the tags are added?
In the API documentation it says that I shall include the keyword 'tag' in the URL but the example given does not. I tried several ways of including 'tag' in the URL but always get a response 'not found'.

You should include a body where c7bc7e9d-5658-44a0-8013-4e12d742b121 is the page id you are updating.
<entry xmlns="http://www.w3.org/2005/Atom">
<category term="document" label="document" scheme="tag:ibm.com,2006:td/type"></category>
<id>urn:lsid:ibm.com:td:c7bc7e9d-5658-44a0-8013-4e12d742b121</id>
</entry>
Template of request
curl -u "<USERID?EMAIL>:<PASSWORD>" -X POST -H "X-Method-Override: PUT" -H "X-Update-Nonce: <NONCE>" -H "Content-Type: application/atom+xml; charset=utf-8" --data "<entry xmlns=\"http://www.w3.org/2005/Atom\"><category term=\"document\" label=\"document\" scheme=\"tag:ibm.com,2006:td/type\"></category><id>urn:lsid:ibm.com:td:<PAGEID></id></entry>" "https://<SERVER>/wikis/basic/api/wiki/<WIKI_ID_OR_LABEL>/page/<PAGE_ID_OR_LABEL>/entry?tag=<TAG>"
I've added the same update to the documentation.

Related

postman render html response and execute JavaScript

I have an http api that give me html response, and I want to "preview" it.
But there is some javascript code in it, and without execute them, it won't give me the right page.
I currently manually copy & paste them in some aaa.html file and use chrome to open it(file://aaa.html), but I want to simplified those steps.
Is there anyway to do that in postman? or is there any postman alternative can do that?
There is an alternative to do this in Postman itself. You will have to use pm.visualizer. Just open your API request which is giving you the HTML response. Then go to the Test tab, add the lines below, and then click on the Visualize tab:
// save your html response in the template and then
const template = pm.response.text();
// set that template to pm.visualizer
pm.visualizer.set(template);
From Postman official documentation
Postman provides a programmable way to visually represent your request responses. Visualization code added to the Tests for a request will render in the Visualize tab for the response body, alongside the Pretty, Raw, and Preview options.
You need add to the Tests for a request:
var template = pm.response.text();
pm.visualizer.set(template);
and see result on the Visualize tab (after Pretty, Raw, and Preview options).
Postman result HTML with JS and CSS
To fix the error:
Refused to load the image 'file:///C:/some.png' because it violates the following Content Security Policy directive: "img-src http: https: data:".
if the content simply does not find (404 Not Found) it along a similar path 'file:///C:/some.file'
need to add the HTML tag to the section of the response body:
var response = pm.response.text();
var base = '<base href="https://some.domain/">";
var template = response.replace('<head>', '<head>' + base);
pm.visualizer.set(template);
this answer also solves the question in this comment.
For more information:
Postman Visualizing responses
HTML <base> tag in MDN Web Docs

Alfresco custom login page, No 'login' page type configured - but page auth required it

I'm trying to create a custom login page following this documentaiuon http://docs.alfresco.com/5.0/tasks/dev-extensions-share-tutorials-override-login-page.html and this http://blog.arvixe.com/customize-alfresco-share-login-page/
But I couldn't get it works and the log show this exceptio,:
org.springframework.extensions.surf.exception.PlatformRuntimeException: 03110000 No 'login' page type configured - but page auth required it.
And the page web shows this massages:
server error has occurred.
There are a number of reasons why this could have happened:
You have attempted to access a page that does not exist - check the URL in the address bar.
You have attempted to access a page that is not accessible to you, such as a private Site dashboard.
A valid page has been requested but the server was unable to render it due to an internal error - contact your administrator.<br/>
Here all my config:
share-config-custom.xml
<config evaluator="string-compare" condition="WebFramework">
<web-framework>
<defaults>
<page-type>
<id>login</id>
<page-instance-id>mhg-login</page-instance-id>
</page-type>
</defaults>
</web-framework>
</config>
template/instances/mhg-login.xml
<template-instance>
<template-type>mhg/mhg-login</template-type>
</template-instance>
pages/mhg-login.xml :
<page>
<template-instance>mhg-login</template-instance>
<authentication>none</authentication>
</page>
Looks to me like you've got the wrong path for your template:
If you copy it from here:
https://github.com/teqnology/alfresco-login-reset-share
you'll see that your template/instances/mhg-login.xml is wrongly configured:
the correct template path is /src/main/amp/config/alfresco/web-extension/site-data/template-instances and the content should be the path to your file which in your case should have a mhg folder (mhg/mhg-login) which I don't see in your details.
Make sure you create the correct path, and you point it to the correct file.
Cheers

Post data to website using Python requests library

I'm trying to make a simple webscaper using Python and the requests library.
r=requests.get(https://nustar.newcastle.edu.au/psp/CS9PRD/EMPLOYEE/HRMS/c/MANAGE_ACADEMIC_RECORDS.STDNT_ACTIVATION.GBL?FolderPath=PORTAL_ROOT_OBJECT.HCSR_RECORDS_AND_REGISTRATION.HCSR_STUDENT_TERM_INFORMATION.HC_STDNT_ACTIVATION_GBL&IsFolder=false&IgnoreParamTempl=FolderPath%2cIsFolder
I would like to POST a search input into this URL, but I'm struggling to work out how.
This is the search box code from the website:
<input id="STDNT_SRCH_EMPLID" class="PSEDITBOX" type="text" maxlength="11" style="width:140px; " value="" tabindex="13" name="STDNT_SRCH_EMPLID"></input>
I assume I have to somehow change value = "" to value = "foo".
Any help will appreciated, thanks.
See request's quick start here.
import requests
value1='foo'
payload = {'STDNT_SRCH_EMPLID': value1} # 'key2': 'value2' and so on (comma delimited)
r = requests.post("http://yourUrl.org/", data=payload)
print(r.text)
Do a network analysis in the developer tool of your browser and copy the curl command of the POST package.
Then you surf to [curl.trillworks.com][1] and convert the curl command by pasting it into a Python POST request.
Inside of your python request you can modify the values.

Check if a URL is still active or Permanently Moved

Is there a way to check if a URL still active or it returns a 301 Redirect code using chhttp?
You've answered your own question - use CFHTTP.
<cfhttp method="head" url="http://www.google.com" result="myResult">
<cfdump var="#myResult#">
You'll see that myResult struct contains "Responseheader" struct with "Status_Code" field in it. It will contain the numeric status code.
If you don't need numeric you can just use myResult.Statuscode - returns something like "200 OK".
If the url will be incorrect or there will be some issues with reaching the target, the "Responseheader" will be empty.
Addendum after the comment:
If you want to know the redirect location after 301 use CFHTTP with trace or options as method.
<cfhttp method="trace" url="http://www.google.com" result="myResult">
The result should contain the "Status_Code" as above as well as "Location" - the url to redirect to.
You have to use the redirect attribute (e.g. redirect="false") in cfhttp tag. Then you get the original response and can figure out what http code was sent back to your request.

Facebook: Change the description/title that appears in a facebook post when I post a URL

I am using a PHP script to post a URL to a fan page that I am an admin of, but the contents of the post always appear as defined by page's <title> tag/<meta type="description"> tag.
Can't the contents of facebook post be changed by using facebook's open graph description(og:description)/title(og:title) tags in the page being posted?
The title can be changed using og:title as long as the page has less than 50 likes (otherwise it is locked in by Facebook). The og:description can be changed at any time.
See: https://developers.facebook.com/docs/opengraph/