Querying Jira issues using OSLC services

The capability to query Jira issues using OSLC vocabulary is declared on the Service Provider representing the Jira project.

Identify the URL of the query capability

To determine the URL of the OSLC query capability:

  1. Request the Service Provider of the Jira project of interest.
  2. Identify the <oslc:Service> XML element whose <oslc:domain> is http://open-services.net/ns/cm#.
  3. Identify the nested <oslc:QueryCapability> XML element whose <oslc:resourceType> is http://open-services.net/ns/cm#ChangeRequest.
  4. Identify the nested <oslc:queryBase> XML element that defines the base URL for the query capability.
<rdf:RDF 
  ...
  <oslc:ServiceProvider rdf:about="https://SERVER:PORT/rest/oslc/1.0/cm/project/PROJECT-ID">
    <oslc:service>
      <oslc:Service>
        <oslc:domain rdf:resource="http://open-services.net/ns/cm#"/>
        <oslc:queryCapability>
          <oslc:QueryCapability>
            <oslc:queryBase rdf:resource="https://SERVER:PORT/rest/oslc/1.0/cm/issue/query/PROJECT-ID"/>
            <oslc:resourceType rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
          </oslc:QueryCapability>
        </oslc:queryCapability>
      </oslc:Service>
    </oslc:service>
  </rdf:Description>
</rdf:RDF>

Execute the query capability

The query capability supports the syntax defined by the OSLC Query Specification. You should get familiar with this specification. The information provided below is a just a brief introduction of the general behavior of a query execution.

Refer to Mapping of Jira fields for OSLC Queries to understand which OSLC properties are supported and their corresponding Jira field.

To execute an OSLC query:

<rdf:RDF 
  ...
  <oslc:ResponseInfo>
    <oslc:totalCount rdf:datatype="http://www.w3.org/2001/XMLSchema#int">22</oslc:totalCount>>
  </oslc:ResponseInfo>
  <rdf:Description rdf:about="jira-query-base-url">
    <rdfs:member>
      <oslc_cm:ChangeRequest rdf:about="jira-isue-url">
         ...
      </oslc_cm:ChangeRequest>
      ...
    </rdfs:member>
  </rdf:Description>
</rdf:RDF>

Query Parameters Support Matrix

Below is the table of OSLC query parameters defined by the specification and the level of support in the connector.

Parameter Supported Description
oslc.where yes Support for immediate properties only; nested properties are not supported.
oslc.searchTerms no
oslc.orderBy no
oslc.select yes Support for immediate properties only; nested properties are not supported. When not present, all properties of matching issues are returned.
oslc.prefix yes This parameter is optional. All namespaces used in Mapping of Jira fields for OSLC Queries are automaticaly recognized.
oslc.paging yes Paging is forced to yes and is always used on server side to avoid overloading the database and Jira server.
oslc.pageSize yes Default page size is 100. Maximum page size is 1000.

Examples of OSLC Queries

Below are typical queries you may execute:

Description Parameters Decoded Parameters
Issues using a given title oslc.where=dcterms%3Atitle%3D%22My%20Title%22 oslc.where=dcterms:title="My Title"
Issues whose identifier is in a given list oslc.where=dcterms%3Aidentifier%20in%20%5B%22SPJ-1%22%2C%22SPJ-2%22%5D oslc.where=dcterms:identifier in ["SPJ-1","SPJ-2"]
Issues whose status is "In Progress" oslc.where=oslc_cm%3Ainprogress%3Dtrue oslc.where=oslc_cm:inprogress=true
Resolved issues oslc.where=oslc_cm%3Afixed%3Dtrue oslc.where=oslc_cm:fixed=true
Resolved issues since a given date oslc.where=oslc_cm%3Afixed%3Dtrue%20and%20dcterms%3AresolutionDate%20%3E%20%222023-11-20T10%3A29%3A00Z%22 oslc.where=oslc_cm:fixed=true and dcterms:resolutionDate > "2023-11-20T10:29:02Z"
Issues having any OSLC link to a given resource oslc.where=*%3D%3Chttps%3A%2F%2FREMOTE%2Frm%2Fresources%2Fresource-id%3E oslc.where=*=<https://REMOTE/rm/resources/resource-id>
Issues whose custom field matches a given value oslc.where=jira_x%3Acustomfield_10500%3D%22Confirmed%22 oslc.where=jira_x:customfield_10500="Confirmed"