Content Server API

Options

HI,

Do we have a small example to understand the working of the content server API in OTAG?

Comments

  • You can use any example you find in this forum or elsewhere. OTAG specifics lie in being a reverse proxy and supporting the SSO with the OTDS.

    Using the reverse proxy means specifying the URL, which you configured on OTAG, instead of the actual CS CGI URL.

    Taking advantage of the SSO is possible if you connect to the CS, which is bound to the same OTDS as your OTAG. You have already logged in to OTAG and thus have the OTDS ticket, which is accepted by the CS REST API too:

    var otcsTicket;
    $.ajax({
      type: "GET", url: "//hostname/cs/cs/api/v1/volumes/142",
      headers: otcsTicket ? { OTCSTicket: otcsTicket } : { OTDSTicket: window.otdsticket }
    }).done(function (response, status, request) {
      otcsTicket = request.getResponseHeader("OTCSTicket");
      alert(response.data.name);
    });
    

    The way I read the OTDS ticket value in the code above is definitely wrong, but someone here will correct me. Thanks! :-) You should exchange the OTDS ticket for the OTCS ticket in your first HTTP request; the OTDS ticket can be single-time usable only and the OTCS ticket, which is native for the CS REST API, offers a better performance.

    You can connect to any CS from OTAG. You'll have to provide some authentication which the CS REST API accepts. It means one of the HTTP headers OTCSTicket, OTDSTicket, MYSAPSSO2 or Authorization (for Basic Authentication).