Main Content


Create resource in OSLC service provider

Since R2021a



    myResource = create(myCreationFactory,resource) submits a creation request to the Open Services for Lifecycle Collaboration (OSLC) service provider associated with the creation factory myCreationFactory for the resource object resource.


    collapse all

    This example shows how to submit a creation request for a user-created resource with a configured OSLC client.

    After you have created and configured an OSLC client myClient as described in Create and Configure an OSLC Client for the Requirements Management Domain, create a creation factory for the requirement resource type.

    myCreationFactory = getCreationFactory(myClient,'Requirement');

    Create a new requirement resource by creating an instance of the oslc.rm.Requirement class.

    myReq = oslc.rm.Requirement
    myReq = 
      Requirement with properties:
        ResourceUrl: ''
              Dirty: 0
          IsFetched: 0
              Title: ''
         Identifier: ''

    Add the dcterms:title property to the requirement and set the value.

    addTextProperty(myReq,'dcterms:title','My New Requirement');

    Submit a creation request to the service provider for the requirement object.

    newReq = create(myCreationFactory,myReq)
    newReq = 
      Requirement with properties:
        ResourceUrl: 'https://localhost:9443/rm/resources/_oJNtgWrqEeup0...'
              Dirty: 1
          IsFetched: 0
              Title: ''
         Identifier: ''

    Retrieve the full resource data for the requirement resource from the service provider. Open the requirement resource in the system browser with the show function..

    status = fetch(newReq,myClient)
    status = 
      StatusCode enumeration

    Input Arguments

    collapse all

    OSLC resource creation factory, specified as an oslc.core.CreationFactory object.

    Output Arguments

    collapse all


    Version History

    Introduced in R2021a