Batch Create Workspaces

post

/primeapi/restapi/workspace/batch

Send a request to this endpoint to create one or more workspaces.

Request

Supported Media Types
Body ()
One or more workspace objects.
Root Schema : List<ApiEntityWorkspace>
Type: array
Title: List<ApiEntityWorkspace>
Show Source
Nested Schema : ApiEntityWorkspace
Type: object
Show Source
Nested Schema : ApiEntityWorkspaceImage
Type: object
Show Source
Nested Schema : workspaceAutonumSettings
Type: array
Unique Items Required: true
An object containing workspace autonumber settings.
Show Source
Nested Schema : workspaceSettings
Type: array
Unique Items Required: true
An object containing workspace settings.
Show Source
Nested Schema : image
Type: array
An image object represented in binary format.
Show Source
Nested Schema : ApiEntityWorkspaceAutonumSetting
Type: object
Show Source
Nested Schema : ApiEntityWorkspaceSetting
Type: object
Show Source

Response

Supported Media Types

201 Response

The object was successfully created.
Body ()
Root Schema : schema
Type: array
Show Source
Nested Schema : ApiEntityWorkspace
Type: object
Show Source
Nested Schema : ApiEntityWorkspaceImage
Type: object
Show Source
Nested Schema : workspaceAutonumSettings
Type: array
Unique Items Required: true
An object containing workspace autonumber settings.
Show Source
Nested Schema : workspaceSettings
Type: array
Unique Items Required: true
An object containing workspace settings.
Show Source
Nested Schema : image
Type: array
An image object represented in binary format.
Show Source
Nested Schema : ApiEntityWorkspaceAutonumSetting
Type: object
Show Source
Nested Schema : ApiEntityWorkspaceSetting
Type: object
Show Source

400 Response

Invalid input.

Examples

The following examples show how to use the API to create workspaces.

Using cURL

Use cURL command line options to form and submit a request to the Prime server.

cURL Command

curl -X GET -H "Accept:application/json" -u "Molly Abraham:password123" -d "[{\"parentWorkspace\":1, \"workspaceCode\":\"s000\", \"workspaceName\":\"Dig Excavation\"},{\"parentWorkspace\":1, \"workspaceCode\":\"e000\", \"workspaceName\":\"Harbor Renovation\"}]" https://localhost:7001/primeapi/restapi/workspace/batch

Using Node JS

Use the Node JS https class interface to form and send an HTTP request to the Oracle Prime API server. Write a Node JS script that forms and sends an HTTP request, then execute the script with node to interact with the server.

Node JS Script

var https = require('https'); 
      var requestDate = JSON.stringify([{ 
      	"parentWorkspace": 1, 
      	"workspaceCode": "s000", 
      	"workspaceName": "Dig Excavation" 
      },{ 
      	"parentWorksapce": 1, 
      	"workspaceCode": "e000", 
      	"workspaceName": "Harbor Renovation" 
      }]); 
      var options = { 
          hostname: "localhost", 
          port: 7001, 
          method: 'POST', 
          path: "/primeapi/restapi/workspace/batch", 
          auth: "Molly Abraham :password123" 
      } 
      var request = https.request(options, function(result){ 
          result.setEncoding('utf8'); 
          result.on('data', function(response){ 
              console.log(response); 
          }); 
      }); 
      request.write(requestData); 
      request.end();

Example Response

When the command executes, the Oracle Prime server returns an HTTP response of content-type application/json:

Example of Response Header

HTTP/1.1 200 OK
Date: Thu, 22 Dec 2016 19:04:45 GMT
Transfer-Encoding: chunked
Content-Type: application/json

Example of Response Body

[{
		"securityGuid": "57D2016A48BA7BBBE05394B8580AE7A6", 
      		"workspaceSettings": [{ 
      				"workspaceSettingId": 59056, 
      				"settingName": "ScopeAssignmentCodeCurrentSuffix", 
      				"settingValue": "0", 
      				"workspaceId": 33001 
      			}, { 
      				"workspaceSettingId": 59009, 
      				"settingName": "ScheduleCheck.Relationship", 
      				"settingValue": "Y", 
      				"workspaceId": 33001 
      			} 
      			//...more workspaceSettings objects 
      		], 
      		"parentWorkspace": 1, 
      		"workspaceCode": "s000", 
      		"workspaceId": 33001, 
      		"workspaceName": "Dig Excavation", 
      		"sequenceNumber": 1530, 
      		"workspaceAutonumSettings": [{ 
      				"autonumId": 49014, 
      				"suffix": "10", 
      				"workspaceId": 33001, 
      				"suffixIncrement": 1, 
      				"prefix": "WP" 
      			}, { 
      				"autonumId": 49001, 
      				"suffix": "10", 
      				"workspaceId": 33001, 
      				"suffixIncrement": 1, 
      				"prefix": "CBT" 
      			}
			//...more workspaceAutonumSettings objects 
      		] 
      	}, { 
      		"securityGuid": "57D2016A48BB7BBBE05394B8580AE7A6", 
      		"workspaceSettings": [{ 
      				"workspaceSettingId": 59167, 
      				"settingName": "ScheduleCheck.NegativeFloat", 
      				"settingValue": "Y", 
      				"workspaceId": 33002 
      			}, { 
      				"workspaceSettingId": 59180, 
      				"settingName": "ScheduleCheck.SoftConstraintsTarget", 
      				"settingValue": "5", 
      				"workspaceId": 33002 
      			} 
      			//...more workspaceSettings objects 
      		], 
      		"parentWorkspace": 1, 
      		"workspaceCode": "e000", 
      		"workspaceId": 33002, 
      		"workspaceName": "Harbor Renovation", 
      		"sequenceNumber": 1530, 
      		"workspaceAutonumSettings": [{ 
      				"autonumId": 49037, 
      				"suffix": "1000", 
      				"workspaceId": 33002, 
      				"suffixIncrement": 10, 
      				"prefix": "A" 
      			}, { 
      				"autonumId": 49022, 
      				"suffix": "10", 
      				"workspaceId": 33002, 
      				"suffixIncrement": 1, 
      				"prefix": "WP" 
      			} 
      			//...more workspaceAutonumSettings objects 
      		] 
      	} 
      ]