2

I'm trying to simply "find" an RTC ticket by ID and it's telling me 404 not found. Maybe I'm supposed to be replacing _ggTXcJdTEeCznlnpJMXHdQ with something? Or jazz or oslc or contexts or the http://purl.org/dc/terms/? I have no idea what's placeholder or not and what I'm supposed to change to be specific to me from the docs.

    public static void GetTicket(string credentials)
    {
        string localhost = "my.host.com";
        string WtId = "2494443"
        string item = "https://" + localhost + ":9443/jazz/oslc/contexts/_ggTXcJdTEeCznlnpJMXHdQ/workitems?" +
            "oslc.where=dcterms:identifier=%22" + WtId + "%22&" +
            "oslc.properties=dcterms:title,dcterms:identifier&" +
            "oslc.prefix=dcterms=%3Chttp://purl.org/dc/terms/%3E";
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(item);
        request.Accept = "application/json";
        request.Headers.Add("Authorization", "Basic " + credentials);
        WebResponse response = request.GetResponse();
        // ... more stuff
    }
CodeMonkey
  • 1,795
  • 3
  • 16
  • 46

1 Answers1

3

Your code comes from the "Query Capabilities" section of the documentation you mention.

And I confirm, _ggTXcJdTEeCznlnpJMXHdQ is part of an example, not something that is expected to work in your own environment.

The discovery mechanism is key:

Clients should not rely on specific URLs or perform path math on URLs. Instead, they should use the discovery chain offered by RTC. Here's an outline of the process to find the Change Management functionality:

The root document is exposed at https://<server>:<port>/<app>/rootservices.
In a typical RTC testbed, this is https://localhost:9443/jazz/rootservices

Fetch this document and extract the Change Management Catalog URL (pointed to by rdf:about) of the element oslc:ServiceProviderCatalog

Fetch the document behind this URL. It contains a list of ServiceProvider elements that point to the documents which contain the actual service descriptions.
In the case of RTC, there is one ServiceProvider element for each Project Area. Typically, an application would use the title of this element to allow the user to choose between the project areas.

Fetch the services document pointed to by property rdf:about of element oslc:ServiceProvider.
This document contains references to services and operations like:

  • Creation Factories to create new work items,
  • Query capabilities that allows to query work items,
  • Delegated UI dialogs to create and select work items, and
  • CLM Filters that are pre-defined queries on work items.

Only by following this discovery path will you get the actual URL to use for your work item query.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Ah! Extremely helpful! Thanks! I found my particular url for "Change request queries" which ends with /workitems and otherwise looks just like the example with my own "key" or whatever. But now, instead of a 404, I get some HTML data rather than the Json I'm requesting and it seems, if I open as an html, that it just shows a Loading screen and otherwise does not have the data I'm looking for? – CodeMonkey Apr 08 '20 at 21:42
  • Maybe I'm just having authorization issues now? I'm trying basic authentication but the doc says "The example snippets assume that you are authenticated to a server configured for form-based authentication." Sounds potentially different... – CodeMonkey Apr 08 '20 at 22:02
  • Yes, authentication issue can also generate a 404 indeed. – VonC Apr 08 '20 at 22:17
  • Well, like I said, I'm not getting 404 now, it's a different issue which I'm suspecting is authentication. I suppose I'll have to open a different question for that though. – CodeMonkey Apr 08 '20 at 23:49