Skip to content

Latest commit

 

History

History
198 lines (140 loc) · 5.47 KB

oslccheatsheet.md

File metadata and controls

198 lines (140 loc) · 5.47 KB

OSLC Requests Cheatsheet

GET requests

SPARQL based GET requests

URL Encoding

Character Code
> %3E
< %3C
+ %2B
- %2D
% %25
: %3A

POST Requests

  • Create Work Task record:
    http://localhost:8001/oslc/so/triWorkTaskCF

    Body:

    {
      "spi:triTaskTypeCL": "Corrective",
      "dcterms:title": "Sample01",
      "spi:action": "Create Draft",
    }
  • Create Work Task and Comment record with association:
    http://localhost:8001/oslc/so/triWorkTaskCF

    Body:

    {
      "spi:triTaskTypeCL": "Corrective",
      "dcterms:title": "Sample02",
      "spi:action": "Create Draft",
      "spi:triAssociatedCommentsLR": 
      [
        {
          "spi:triCommentTX": "This is a comment.",
          "spi:triCommentTypeLI":"E-mail",
          "spi:action": "Create"
        },
        {
         "spi:triCommentTX": "This is another comment.",
         "spi:triCommentTypeLI":"E-mail",
         "spi:action": "Create"
        }
      ]
    }
  • Create Work Task record and associate with existing record:
    http://localhost:8001/oslc/so/triWorkTaskCF

    Body:

    {
      "spi:triTaskTypeCL": "Corrective",
      "dcterms:title": "Sample03",
      "spi:action": "Create Draft",
      "spi:triAssociatedComments": 
      [
        {
          "dcterms:identifier": "132633922" (spec_id)
        }
      ]
    }

Update using PUT

  • PUT request essentially replaces the record and only retains the info that is passed in the request. Thereby, PUT is rarely used. Read the documentation here.

Update using POST - PATCH - MERGE

Header Name Header Value
x-method-override PATCH
PATCHTYPE MERGE

DELETE

Document Integration via OSLC

  • Document content (file) can downloaded by prefixing OSLC Resource with Document spec_id and /Content. e.g.

    https://localhost:8001/oslc/so/triDocumentRS/142284589/Content 
    
  • Document content (file) can be uploaded and associated to a record by using POST with the given headers as shown.

    POST: https://localhost:8001/oslc/so/triDocumentRS/triWorkTaskRS/137313454
    
    Header Value
    Content-Type multipart/form-data, image/png
    authorization Basic RE0xOkRNMDFfbWNz
    Accept application/json
    Slug testImage6.png
    x-document-description Test Image 5
    x-document-meta \ROOT\TRIRIGAAnywhere
    Properties *

Other Facts

  • Pagination can be added to OSLC records using:

    ?oslc.paging=true&oslc.page=<pagenumber>&oslc.pageSize=<pagesize>
    
  • Duration fields can be mapped as shown below.


  • These errors don't show up for Boolean fields because it takes FALSE as default.