Can somebody tell me how can I test RESTful services in Content Server 10.5. I can't find any documentation in KC.
Hi,
This should be a basic working sample to get the Enterprise node:
<script type="text/javascript" src="http://2008rktsupport/imgcs105/core/jquery-1.7.2.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.post("http://hostname/cs105/cs.exe/api/v1/auth",
{
username:"Admin",
password:"livelink"
},
function(data,status){
var ticket = data.ticket;
$.ajax({
type: "GET",
url: "http://hostname/cs105/cs.exe/api/v1/nodes/2000",
headers: {"OTCSTICKET": ticket},
dataType: "text",
success: function(resp){
// we have the response
alert(resp);
error: function(e){
alert('Error: ' + e);
}
});
</script>
<button>Get Enterprise Node </button>
The key is to first request a token and then pass it back in to the header of the nodes call.
Regards
Ian WhitfieldSenior Support Analyst | Resonate KT
Phone:
+44 (118) 984 8358
Mobile:
+44 (782) 470 9641
LinkedIn:
http://www.linkedin.com/profile/view?id=38592772
Twitter:
@OpenText
Website:
www.opentext.com
This email message is confidential, may be privileged, and is intended for the exclusive use of the addressee. Any other person is strictly prohibited from disclosing or reproducing it. If the addressee cannot be reached or is unknown to you, please inform the sender by return email and delete this email message and all copies immediately.
From: eLink Entry: Content Server Development Forum [mailto:development@elinkkc.opentext.com]Sent: 14 January 2014 23:58To: eLink RecipientSubject: RESTful Services urls
RESTful Services urls
Posted byhari.mothukuri@vwcredit.com (Mothukuri, Hari) On 01-14-2014 18:44
[To post a comment, use the normal reply function]
Forum:
Content Server Development Forum
Content Server:
Knowledge Center
Information on AppWorks and the related REST APIs are available on http://developer.opentext.com. For future reference, this is also linked to from the Content Server SDK documentation area under the Content Server SDK section of the OTDN community:
https://knowledge.opentext.com/knowledge/cs.dll?func=ll&objId=42329092&objAction=browse&viewType=1 The REST APIs are supported through the forums on developer.opentext.com, so posting any questions there should get you any assistance you require. Cheers, Kyle
Thank you very much!
Trying to get Ian's example to work in CS 10 Update 13 (not 10.5).
Authentication part seems to work and I can print out ticket from response. But I can't get node list working.
I get some kind of authorization error:
Hi Guys,
I am getting "HTTP 500 Internal Server Error" when I try to authenticate user:
http://csserver/otcs/cs.exe/api/v1/auth?username=Admin&password=livelink
Can you please guide if I am missing any configurations? I am not using appworks but directly trying to access rest service with cs 10 update 13.
Regards,
Munir
Thanks for the response Ferda,
Even that code does not work for me.
Below is the sample I was trying to use
Also when I try to POST using DotNet code, I get below error:
The underlying connection was closed: An unexpected error occurred on a receive.
Hallo
i tried the same (but to query the SOAP WebServices) last year but i stoped without success
in IE i ended in ajax { :success {} }, but with an empty response
in FF i ended in ajax { {}}
unfortunatly i had not yet time to dive further ...
so if you are successful, i would be intressed in the solution ....
with SoapUI ( http://www.soapui.org) i was successful to query some tests
Thomas
I have tested http://10.255.128.71/otcs/cs.exe/api/v1/auth?username=admin&password=livelink successfully in Soap UI and recevied ticket in JSON.
Can you please guide me how I can test Url passing OTCTICKET ticket method type as Get.
example from knowledge center.
Thank you,
I have sent user Authentication with the given credentials.
Received OTCS ticket from OpenText.
Content type as JSON.
How do I send OTCS ticket to OpenText to access url: "http://hostname/cs105/cs.exe/api/v1/nodes/2000".
Currently i am using rest services in peoplesoft. Where I am supposed to give URL to talk.
How can I send OTCS ticket in an URL formate?
How do I test SoapUI?
Authentication Header (the value can be obtained from an Auth call):
name
The answer you're looking for is in the thread that Kyle posted a link to:
https://developer.opentext.com/webaccess/#url=/awd/forums/questions/7234#r7235
Specifically, if you're using jQuery, you need to pass the OTCS token in the headers but use 'beforesend', i.e.
$
You may not need the headers line if you're doing the beforeSend. For the authentication itself, you *must* do this as POST. If you get it to work as GET there's something very wrong, and this is frankly a massive security hole. Doing this as POST mitigates this somewhat, and doing it as a POST over https is reasonably secure. When authenticating, something like this
$.post(url + "/auth", credentials, function (response) { var ticket = response.ticket; });
prior to your calling the nodes API should work. Note the above was done using jQuery 1.10. CS 10.0 ships with jQuery 1.3.2 and 10.5 with 1.7.2 (don't know what version CS16 ships with). The reason I mention the jQuery version is you may receive a string or a parsed object depending on your version of jQuery - your mileage WILL very
When having to support different jQuery versions, I prefer using the oldest available interface to specifying single parameter twice.
Passing the authorization ticket to any call:
jQuery >= 1.0:
$.ajax({ ..., beforeSend: function (request) { request.setRequestHeader('OTCSTicket', ticket); } })
jQuery >= 1.5:
$.ajax({ ..., headers: {OTCSTicket: ticket}, })
Consuming the response of any call:
jQuery >= 1.0.4:
$.ajax({ ..., dataType: 'json', success: function (response) { // response is a JSON object } })
jQuery >= 1.4:
$.ajax({ ..., success: function (response) { // response is a JSON object } })
And a complete scenario getting child nodes in Enterprise Volume:
jQuery >= 1.8:
var cgiUrl = '...', credentials = { username: '...', password: '...' }; $.ajax({ type: 'POST', url: cgiUrl + '/api/v1/auth', data: credentials }) .then(function (response) { var ticket = response.ticket; return $.ajax({ url: cgiUrl + '/api/v1/volumes/141/nodes', headers: {OTCSTicket: ticket} }); }) .then(function (response) { var children = response.data; ... })
In a real-world scenario you would get an authorization ticket from the portal, where you page has been deployed; usually OTDSTicket. OTCSTicket, if your page is a CS request handler.
It is not possible to pass OTCSTicket or OTDSTicket as a URL query parameter.
As an alternative, we could introduce a once-only usable ticket, which you could use in URL query parameters to authorize a GET request. The current CS REST API does not accept any such ticket on the general level (for any request).
You used the request content type "application/json". CS REST API supports only "application/x-www-form-urlencoded" or "multipart/form-data". You have to choose one of these two content types and serialize the request body according to it.
If you use OTDS for authentication with CS 10.x, and not the CS alone, you need to use "otadmin@otds.admin" instead of "Admin" as login user name.
I do not recommend you using $.ajax for making SOAP WS calls. SOAP is a complicated protocol. You should use REST API in the browser.
You can add the OTCSTicket as Custom HTTP Header in Soap UI. However, I recommend you using a testing client more suitable tor RESTful APIs, like Postman.