问题
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
}
回答1:
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 ishttps://localhost:9443/jazz/rootservices
Fetch this document and extract the Change Management Catalog URL (pointed to by
rdf:about
) of the elementoslc: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 oneServiceProvider
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 elementoslc: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.
来源:https://stackoverflow.com/questions/61108722/rtc-simple-id-query-results-in-404