Calendar & Import API (v2.0)

Relative Path: /api/v2/calendar

Relative Path: /api/v2/import

Common

DayOfWeek Enum

DayOfWeek values should be identified by an integer where each value is one of the following:

0

Sunday

1

Monday

2

Tuesday

3

Wednesday

4

Thursday

5

Friday

6

Saturday

Severity Enum

0

Error

1

Warning

2

Info

PartType Enum

Can be identified by either the string or numeric value.

1

Buy

2

Make

3

Distributed

ImportMode Enum

0

Update

1

Replace

2

ReplaceByLocation

ImportType Enum

0

Unidentified

1

Host

2

Edit

ImportOptions Enum

0

None

1

KeepExportedOrders

ImportStatus Enum

0

Open

1

Ready

2

Processing

3

Complete

ImportItemType Enum

0

BillOfMaterial

1

BufferProfile

2

CycleDayAdjustmentFactor

3

DemandForecast

4

DemandOrder

5

Part

6

PartBufferSizing

7

PartInventory

8

PlannedAdjustmentFactor

9

SupplyOrder

10

PartUnitOfMeasure

11

PlanningCalendar

12

DemandHistory

Common Arguments

dataSetId

See the GET /api/v2/ data interface for a list of valid values.

0

The current "production" dataSet.

Error Info

When an error is encountered, an ErrorInfo response will be returned with more info. Not all fields may be relevant. This is meant to add information to an HTTP Error Response Code to aid in debugging.

Calendar API Methods

Calendar Summary

Get Calendar Summary

Get the list of all calendars for a given dataset id, excluding past calendars

Url

/api/v2/calendar/{dataSetId}

Method

GET

Url Params

datasetId

Integer, required

A valid DataSetID.

Request Body

None

Success response

200 OK

Success Body

{

"partTypeCalendars": [

{

"partType": {partType}

"days": [{dayOfWeek}],

}

],

"locations":[

{

"name": "LOC1",

"partTypeCalendars": [

{

"partType": {partType},

"days": [{dayOfWeek}],

}

],

"shutdownPeriods":[

{

"id":{string},

"partType": {partType},

"startDate":{date},

"endDate":{date},

"description":{string}

},

]

}

],

"vendors":[

{

"name": {string},

"shutdownPeriods":[

{

"id":{string},

"partType": {partType},

"startDate":{date},

"endDate":{date},

"description":{string}

},

]

}

]

}

Error Responses

404 NOT FOUND: Invalid datasetId

Example:

GET /api/v2/calendar/1

Accept: application/json

200 OK

Content-Type: application/json; charset=utf-8

{

"partTypeCalendars": [

{

"partType": "make"

"days": [1,2,3,4,5],

},

{

"partType": "buy",

"days": [1,2,3,4,5],

}

],

"locations":[

{

"name": "LOC1",

"partTypeCalendars": [

{

"partType": "buy",

"days": [1,2,3,4,5],

}

],

"shutdownPeriods":[

{

"id":"329872398328973289372",

"partType": "make",

"startDate":"2018-12-22",

"endDate":"2018-12-24",

"description":"Christmas 2018"

},

]

}

],

"vendors":[

{

"name": "Vendor1",

"shutdownPeriods":[

{

"id":"329872398328973289372",

"partType": "make",

"startDate":"2018-12-22",

"endDate":"2018-12-24",

"description":"Christmas 2018"

},

]

}

],

"planningCalendars": [

{

"name": "weekdays"

"days": [1,2,3,4,5],

},

{

"name": "everyday",

"days": [0,1,2,3,4,5,6],

}

],

}

Default Calendars

Get Default Calendars

Get the list of default calendars for a given dataset id.

Url

/api/v2/calendar/{dataSetId}/default

Method

GET

Url Params

datasetId

Integer, required

A valid DataSetID.

Request Body

None

Success response

200 OK

Success Body

{

"partTypeCalendars": [

{

"partType": {partType}

"days": [{dayOfWeek}],

}

]

}

Error response

404 NOT FOUND: Invalid datasetId

Example

GET /api/v2/calendar/1/default

Accept: application/json

200 OK

Content-Type: application/json

{

"partTypeCalendars": [

{

"partType": "make"

"days": [1,2,3,4,5],

},

{

"partType": "buy",

"days": [1,2,3,4,5],

}

],

}

Update Default Calendars

update default calendars for a given dataset id

Url

/api/v2/calendar/{dataSetId}/default

Method

POST or PUT

Url Params

datasetId

Integer, required

A valid DataSetID.

Request Body

{

"partTypeCalendars": [

{

"partType": {partType}

"days": [{dayOfWeek}],

}

]

}

Success response

204 NO CONTENT

The update was made successfully.

Error response

404 NOT FOUND:

Invalid dataSetId

400 BAD REQUEST:

The request could not be parsed or is invalid.

Example

Location Calendars

Get Location Calendar

Get the location calendar data for a given dataset and location.

Url

/api/v2/calendar/{dataSetId}/location/?name={locationName}

Method

GET

Url Params

datasetId

Integer, required

A valid DataSetID.

locationName

String, required

A location name

Request Body

None

Success response

200 OK

Success Body

{

"name": {string},

"partTypeCalendars": [

{

"partType": {partType},

"days": [{dayOfWeek}],

}

],

"shutdownPeriods":[

{

"id":{string},

"partType": {partType},

"startDate": {date},

"endDate": {date},

"description":{string}

},

]

}

Error response

404 NOT FOUND:

Invalid dataSetId or locationName

Example

200 OK

{

"name": "LOC1",

"partTypeCalendars": [

{

"partType": "buy",

"days": [1,2,3,4,5],

}

],

"shutdownPeriods":[

{

"id":"1234",

"partType": "make",

"startDate":"2018-05-30",

"endDate":"2018-05-31",

"description":"Memorial Day"

},

{

"id":"1234",

"partType": "buy",

"startDate":"2018-12-22",

"endDate":"2018-12-24",

"description":"Christmas 2018"

},

]

}

Update Location Calendar

Update location calendar for a given dataset id. These are the days of the week that a location is active and working and will count towards a part's lead time.

Url

/api/v2/calendar/{dataSetId}/location?name={locationName}

Method

PUT or POST

Url Params

dataSetId

Integer, required

A valid DataSet ID.

locationName

String, required

A location name

Request Body

{

"partTypeCalendars": [

{

"partType": {partType},

"days": [{dayOfWeek}],

}

]

}

Success response

204 NO CONTENT

The location calendar for the specified part types were updated successfully.

Error response

404 NOT FOUND:

Invalid dataSetId or locationName

400 BAD REQUEST:

The request could not be parsed or is invalid.

Example

PUT /api/v2/calendar/1/location?name=LOC1

Content-Type: application/json

{

"partTypeCalendars": [

{

"partType": "buy",

"days": [1,2,3,4,5],

}

],

}

204 NO CONTENT

Location: /api/v2/calendar/1/location?name=LOC1

Delete Location Calendar

Delete the location calendar (working days) for a location. After the deletion, the default calendar will apply to all parts of that type, at that location.

Url

/api/v2/calendar/{dataSetId}/location?name={locationName}&type={partType}

Method

DELETE

Url Params

dataSetId

Integer, required

A valid DataSet ID.

locationName

String, required

A location name

partType

PartType, optional

A valid Part \Type

Note

The partType parameter is optional. Leaving it unspecified will delete all of the partType calendar overrides for a location.

Request Body

Success response

204 NO CONTENT

The operation was successful and the location calendar is deleted. The default calendar for this part type will apply to parts at this location.

Error response

404 NOT FOUND:

Invalid dataSetId or locationName

400 BAD REQUEST:

The request could not be parsed or is invalid.

Example

DELETE /api/v2/calendar/1/location?name=LOC1&type=make

204 NO CONTENT

Delete Location Calendars

Deletes the working day calendar overrides for one or more Part Types at a Location.

Url

/api/v2/calendar/{dataSetId}/location?name={locationName}

Method

DELETE

Url Params

dataSetId

Integer, required

A valid DataSet ID.

locationName

String, required

A location name

Request Body

{

"partTypes":[{partType}]

}

Success response

204 NO CONTENT

The operation was successful and the location calendar is deleted. The default calendar for this part type will apply to parts at this location.

Error response

404 NOT FOUND:

Invalid dataSetId or locationName

400 BAD REQUEST:

The request could not be parsed or is invalid.

Example

DELETE /api/v2/calendar/1/location?name=LOC1

Content-Type: application/json

{

"partTypes":["make","buy"]

}

204 NO CONTENT

Create Location Calendar Shutdown Period

Create a shutdown period for a location

Url

/api/v2/calendar/{dataSetId}/location?name={locationName}

Method

POST

Url Params

datasetId

Integer, required

A valid DataSetID.

locationName

String, required

A location name

Request Body

{

"shutdownPeriods":[

{

"partType": {partType},

"startDate": {date},

"endDate": {date},

"description":{string}

},

]

}

Success response

201 CREATED

The shutdown periods were successfully created for the specified location.

Error response

404 NOT FOUND:

Invalid dataSetId or locationName

400 BAD REQUEST:

The request could not be parsed or is invalid.

Delete Location Calendar Shutdown Period

Deletes a Shutdown Period for the specified Location

Url

/api/v2/calendar/{dataSetId}/location?name={locationName}&shutdown={id}

Method

DELETE

Url Params

dataSetId

Integer, required

A valid DataSetID.

locationName

String, required

A location name

Id

String, required

A shutdown period id

Request Body

None

Success response

204 NO CONTENT

The shutdown period was successfully deleted from the location.

Error response

404 NOT FOUND:

Invalid dataSetId, locationName, or id.

400 BAD REQUEST:

The request could not be parsed or is invalid.

Example

DELETE /api/v2/calendar/1/location?name=LOC1&id=234234234

204 NO CONTENT

Delete Location Calendar Shutdown Periods

Deletes one or more Shutdown Periods for the specified Location.

Url

/api/v2/calendar/{dataSetId}/location?name={locationName}

Method

DELETE

Url Params

dataSetId

Integer, required

A valid DataSetID.

locationName

String, required

A location name

Request Body

{

"shutdownPeriods":[{string}]

}

Success response

204 NO CONTENT

The shutdown period was successfully deleted from the location.

Error response

404 NOT FOUND:

Invalid dataSetId, or locationName.

400 BAD REQUEST:

The request could not be parsed or is invalid.

Example

DELETE /api/v2/calendar/1/location?name=LOC1

Content-Type: application/json

{

"shutdownPeriods":[

"234234234",

"3334442"

]

}

204 NO CONTENT

Vendor Calendars

Get Vendor Calendars

Get the list of vendor calendars for a given dataset id.

Url

/api/v2/calendar/{dataSetId}/vendor/?name={vendorName}

Method

GET

Url Params

dataSetId

Integer, required

A valid DataSet ID.

vendorName

String, required

A valid Vendor name

Request Body

None

Success response

200 OK

Success Body

{

"name": {string},

"shutdownPeriods":[

{

"id":{string},

"partType": {partType},

"startDate": {date},

"endDate": {date},

"description":{string}

},

]

}

Error response

404 NOT FOUND:

Invalid dataSetId, or vendorName.

Notes

Create Vendor Calendar Shutdown Periods

Create one or more shutdown periods for a Vendor.

Url

/api/v2/calendar/{dataSetId}/vendor?name={vendorName}

Method

POST

Url Params

datasetId

Integer, required

A valid DataSet ID.

vendorName

String, required

A Vendor name

Request Body

{

"shutdownPeriods":[

{

"partType": {partType},

"startDate": {date},

"endDate": {date},

"description":{string}

},

]

}

Success response

201 CREATED

The shutdown periods were successfully created for the specified Vendor.

Error response

404 NOT FOUND:

Invalid dataSetId or locationName

400 BAD REQUEST:

The request could not be parsed or is invalid.

Delete Vendor Calendar Shutdown Period

Deletes a single Shutdown Period for the specified Vendor.

Url

/api/v2/calendar/{dataSetId}/vendor?name={vendorName}&shutdown={id}

Method

DELETE

Url Params

dataSetId

Integer, required

A valid DataSet ID.

vendorName

String, required

A Vendor name

Id

String, required

A shutdown period id

Request Body

None

Success response

204 NO CONTENT

The shutdown period was successfully deleted from the Vendor.

Error response

404 NOT FOUND:

Invalid dataSetId, vendorName, or id.

400 BAD REQUEST:

The request could not be parsed or is invalid.

Example

DELETE /api/v2/calendar/1/vendor?name=Vendor1&id=234234234

204 NO CONTENT

Delete Vendor Calendar Shutdown Periods

Deletes one or more Shutdown Periods for the specified Vendor

Url

/api/v2/calendar/{dataSetId}/vendor?name={vendorName}

Method

DELETE

Url Params

dataSetId

Integer, required

A valid DataSet ID.

vendorName

String, required

A Vendor name

Request Body

{

"shutdownPeriods":[{string}]

}

Success response

204 NO CONTENT

The shutdown period was successfully deleted from the Vendor.

Error response

404 NOT FOUND:

Invalid dataSetId, or vendorName.

400 BAD REQUEST:

The request could not be parsed or is invalid.

Example

DELETE /api/v2/calendar/1/vendor?name=LOC1

Content-Type: application/json

{

"shutdownPeriods":[

"234234234",

"3334442"

]

}

204 NO CONTENT

Planning Calendar

Get Planning Calendars

Gets a list of all Planning Calendars, excluding past calendars

Url

/api/v2/calendar/{dataSetId}/planning

Method

GET

Url Params

datasetId

Integer, required

A valid DataSetID.

Request Body

None

Success response

200 OK

Success Body

{

"planningCalendars": [

{

"name": {string}

"days": [{dayOfWeek}],

}

]

}

Error response

404 Not Found

Invalid datasetId

Example

GET /api/v2/calendar/1/planning

Accept: application/json

200 OK

Content-Type: application/json

{

"planningCalendars": [

{

"name": "weekdays"

"days": [1,2,3,4,5],

},

{

"name": "everyday",

"days": [0,1,2,3,4,5,6],

}

],

}

Create or Update Planning Calendars

Update or create one or more Planning Calendars

Url

/api/v2/calendar/{dataSetId}/planning

Method

POST or PUT

Url Params

datasetId

Integer, required

A valid DataSetID.

Request Body

{

"planningCalendars": [

{

"name": {string}

"days": [{dayOfWeek}],

}

]

}

Success response

204 No Content

The operation completed successfully.

Error response

404 Not Found:

Invalid dataSetId

400 Bad Request:

The request could not be parsed or is invalid.

Example

PUT /api/v2/calendar/1/planning

Content-Type: application/json

{

"planningCalendars":[

{

"name":"MWF",

"days":[1,3,5]

}

]

}

204 NO CONTENT

Delete Planning Calendar

Deletes a Shutdown Period for the specified location. All parts that were assigned to use the specified Planning Calendar will be modified to use no Planning Calendar.

Url

/api/v2/calendar/{dataSetId}/planning?name={planningCalendarName}

Method

DELETE

Url Params

dataSetId

Integer, required

A valid DataSetID.

planningCalendarName

String, required

A Planning Calendar name

Request Body

None

Success response

204 NO CONTENT

The planning calendar was deleted.

Error response

404 NOT FOUND:

Invalid dataSetId, or planningCalendarName.

400 BAD REQUEST:

The request could not be parsed or is invalid.

Example

DELETE /api/v2/calendar/1/planning?name=MWF

204 NO CONTENT

Delete Planning Calendars

Deletes one or more Planning Calendars. All parts that were assigned to use the specified Planning Calendars will be modified to use no Planning Calendar.

Url

/api/v2/calendar/{dataSetId}/planning

Method

DELETE

Url Params

dataSetId

Integer, required

A valid DataSetID.

Request Body

{

"planningCalendarNames":[{string}]

}

Success response

204 NO CONTENT

The planning calendars were successfully deleted.

Error response

404 NOT FOUND:

Invalid dataSetId, or planningCalendarNames.

400 BAD REQUEST:

The request could not be parsed or is invalid.

Example

DELETE /api/v2/calendar/1/planning

Content-Type: application/json

{

"planningCalendarNames":[

"MWF",

"Mondays"

]

}

204 NO CONTENT

Import API Methods

Get All Imports

Get the list of all imports

Url

/api/v2/import

Method

GET

Url Params

None

Request Body

None

Success response

200 OK

Success Body

{

imports: [{

"ImportId": {int},

"DataSetId": {int},

"Status": {importStatus},

"Mode": {importMode},

"Type": {importType},

"Option": int,

"DateCompletedUtc": {datetime},

"IsValidationComplete": {bool},

"AnyIssues": bool,

"TotalParsingErrors": int,

"TotalValidationErrors": int,

"TotalValidationWarnings": int,

"TotalValidationInfo": int

}]

}

Error response

Example

GET /api/v2/import

Accept: application/json

200 OK

Content-Type: application/json

{

"imports":[{

"ImportId": 97,

"DataSetId": 1,

"Status": 2,

"Mode": 1,

"Type": 1,

"Option": 0,

"DateCompletedUtc": null,

"IsValidationComplete": false,

"AnyIssues": true,

"TotalParsingErrors": 12,

"TotalValidationErrors": 0,

"TotalValidationWarnings": 70,

"TotalValidationInfo": 0

}, {

"ImportId": 101,

"DataSetId": 1,

"Status": 3,

"Mode": 1,

"Type": 1,

"Option": 0,

"DateCompletedUtc": "2018-11-29T18:31:38.457Z",

"IsValidationComplete": true,

"AnyIssues": false,

"TotalParsingErrors": 0,

"TotalValidationErrors": 0,

"TotalValidationWarnings": 0,

"TotalValidationInfo": 0

}]

}

Create Import

Create a new Import Container

Url

/api/v2/import

Method

POST

Url Params

None

Request Body

{

"mode": {int},

"type": {int},

"option": {int}

}

Success response

201 Created

The import was created successfully.

Error response

404 Not Found:

If the requested dataSetId is not found.

400 Bad Request:

If Type, Mode or Option are invalid enum values.

Example

POST /api/v2/import

Content-Type: application/json

{

"mode": 1,

"type": 1,

"option": 0,

}

201 Created

Location: /api/v2/import/100

Get Import Summary

Gets a summary of a single Import and its import items.

Url

/api/v2/import/{importId}

Method

GET

Url Params

importId

Integer, required

A valid Import ID.

Request Body

None

Success response

200 OK

Success Body

{

"Id": {int},

"DataSetId": {int},

"Status": {int},

"Mode": {int},

"Type": {int},

"Option": {int},

"DateCompletedUtc": {datetime},

"IsValidationComplete": {bool},

"AnyIssues": {bool},

"TotalParsingErrors": {int},

"TotalValidationErrors": {int},

"TotalValidationWarnings": {int},

"TotalValidationInfo": {int},

"items":[

{

"type": {importItemType},

"Status": {importItemStatus},

"FileName": {string},

"ParsingErrors": [{string}],

"ValidationResults": [{string}],

"RecordCount": {int},

"ProcessedCount": {int},

"IgnoredCount": {int},

"DateUploadedUtc": {datetime},

"DateValidatedUtc": {datetime},

"ValidatedByRPlusVersion": {string}

}

]

}

Error response

404 NOT FOUND:

If ImportId can’t be found.

Example

GET /api/v2/import/97

Accept: application/json

200 OK

Content-Type: application/json

{

"Id": 97,

"DataSetId": 1,

"UserName": "john",

"Status": 2,

"Mode": 1,

"Type": 1,

"Option": 0,

"DateCompletedUtc": null,

"IsValidationComplete": false,

"AnyIssues": true,

"TotalParsingErrors": 12,

"TotalValidationErrors": 0,

"TotalValidationWarnings": 70,

"TotalValidationInfo": 0,

"items": [

{

"type": "part",

"Status": 2,

"FileName": "myparts.csv",

"RecordCount": 42,

"ProcessedCount": 0,

"IgnoredCount": 0,

"DateUploadedUtc": "",

"DateValidatedUtc": "2018-03-23T22:04:03Z",

"ValidatedByRPlusVersion": "4.4.247.3"

}

]

}

Update Import

Update the settings of a given import.

Url

/api/v2/import/{importId}

Method

PUT

Url Params

importId

Integer, required

A valid Import ID.

Request Body

{

"mode":{importMode},

"type": {importType},

"option":{importOptions}

}

Success response

204 No Content

Error response

404 Not Found:

If the importId doesn't exist, it shows error.

400 Bad Request

Invalid enum values

405 Method Not Allowed

The Import is queued for processing, currently processing, or done processing.

Example

PUT /import/v2/import/76

Content-Type: application/json

{

"mode": 1,

"type": 1,

"option": 0

}

204 No Content

Location: /api/v2/import/76

Delete Import

Url

/api/v2/import/{importId}

Method

DELETE

Url Params

importId

Integer, required

A valid Import ID.

Request Body

None

Success response

204 No Content

Error response

404 Not Found

If ImportId doesn’t exist

405 Method Not Allowed

The Import is queued for processing, or currently processing.

Create Import Item

Url

/api/v2/import/{importId}/item?type={itemType}

Method

POST or PUT

Url Params

importId

Integer, required

A valid Import ID.

itemType

ItemType, optional *

Required when uploading a CSV File.

Request Body

(Required)

We accept 3 different data types:

1)

Data Type: text/csv

Data Content: (the csv content following CSV spec for the specific item type)

2)

Data type: application/json

Data content: the json format of the class DDTech.RPlus.DTO.SystemOfRecord.xxx (xxx is the item type)

3)

Data type: application/xml

Data content: the xml format of the class DDTech.RPlus.DTO.SystemOfRecord.xxx (xxx is the item type)

Success response

201 Created

Error response

404 Not Found

If importId doesn’t exist.

If no data found for the specified ImportId and ItemType.

400 Bad Request

If ItemType is not valid or is not specified (for csv files)

405 Method Not Allowed

The Import is queued for processing, currently processing, or done processing.

Delete Import Item

Url

/api/v2/import/{importId}/item?type={itemType}

Method

DELETE

Url Params

importId

Integer, required

A valid Import ID.

itemType

Item Type, required

Request Body

None

Success response

204 No Content

The Import Item was successfully deleted.

Error response

404 Not Found:

If importId doesn’t exist.

If no data found for the specified ImportId and ItemType.

400 Bad Request:

If ItemType is not valid

405 Method Not Allowed

The Import is queued for processing, currently processing, or done processing.

Get Import Validation Errors

Gets the detailed status and validation of all of the Import Items for an Import.

Url

/api/v2/import/{importId}/results

Method

GET

Url Params

importId

Integer, required

A valid Import ID.

Request Body

None

Success response

200 OK

See Success Body

204 No Content

The import is currently running.

Success Body

{

"items": [

{

"type": {importItemType},

"Status": {importItemStatus},

"FileName": {string},

"RecordCount": {int},

"ProcessedCount": {int},

"IgnoredCount": {int},

"DateUploadedUtc": {datetime},

"DateValidatedUtc": {dateTime},

"ValidatedByRPlusVersion": {string}

"validationErrors": [

{

"Severity": {severity},

"ErrorText": {string},

"ErrorType": {string},

"RecordData": {

"Properties": {

"PartNumber": {string},

"Revision": {string},

"Location": {string}

},

"RecordNumber": {int},

"RecordTypeName": {importItemType}

},

]

}

],

}

Error response

404 Not Found

If invalid ImportId.

Run an Import

Run an import job, including Validation.

Url

/api/v2/import/{importId}/run

Method

POST

Url Params

importId

Integer, required

A valid Import ID.

Request Body

None

Success response

202 Accepted

Error response

404 Not Found

If invalid ImportId.

405 Method Not Allowed

The import is currently queued for processing, currently processing, or has already been processed.

Run Validation on an Import

Url

/api/v2/import/{importId}/validate

Method

POST

Url Params

importId

Integer, required

A valid Import ID.

Request Body

None

Success response

202 Accepted

Error response

404 Not Found

If invalid ImportId.

405 Method Not Allowed

If the import is already queued for validation or import, or is previously validated or imported.

Last updated