HistoryViewLinks to this page 2012 September 7 | 01:30 pm

This scenario assumes that the service provider permits the creation of new Architecture resources, and that the user has sufficient previledges to do so.

This scenario requires that the client has already discovered the AM Resource URI via the service provider catalog.

The typical behavoir of a sucessfull HTTP POST to create the new resources and return an entity which describes the status of the request and newly created resource (RFC 2616 Section 10.2.2). The server SHOULD return the ETag in a header, and include the URI of the new resource in the Location header.

Example 1. Create new UML Class

1. The client obtains the Resource Factory URL from the discover documents and POSTs a new resource to the service provider AM resource factory URL. The content type MUST be the content type of the resource and NOT the OSLC AM content type.

2. The client POSTs a resource to AMR Resource Factory URI ( https://am.acme.com/resources/project1). Successful creation will result in a 201 Created response. The ETag, and Location headers MUST be returned.

Request

POST https://am.acme.com/resources/project1
Content-Type: application/x-acme-uml+xml

<uml:Class xmlns:uml="http://acme.com/uml/1.0#">
   <uml:name>Class1</uml:name>
   <uml:abstract>true</uml:abstract>
</uml:Class>  

Response

201 Created
Location: https://am.acme.com/resources/res991
ETag: "_siemvnshyu2746sakalfuy"
Content-Type: application/x-oslc-am-resource+xml

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/terms/" 
   xmlns:oslc_am="http://open-services.net/xmlns/am/1.0/"
   rdf:about="https://acme.com/resources/res1">

    <rdf:Description>
      <dc:title>Class1</dc:title>
      <dc:type rdf:resource="http://acme.com/uml/1.0#Class" />
      <dc:format>application/x-acme-uml+xml</dc:format>
    </rdf:Description> 

</rdf:RDF> 

Example 2. Failed attempt to create new UML Class

1. The client POSTs a resource to AMR Resource Factory URI ( https://am.acme.com/resources/project1). The service provider does not permit the creation of new resources.

Request

POST https://am.acme.com/resources/project1
Content-Type: application/x-acme-uml+xml

<uml:Class xmlns:uml="http://acme.com/uml/1.0#">
   <uml:name>Class1</uml:name>
   <uml:abstract>true</uml:abstract>
</uml:Class>  

Response

403 Forbidden
Content-Type: application/rdf+xml


<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:oslc="http://open-services.net/xmlns/common/1.0/">
    <oslc:Error>
        <oslc:statusCode>403</oslc:statusCode>
        <oslc:message>The server does not permit the creation of new resources.</oslc:message>
    </oslc:Error>
</rdf:RDF>