Information about supported interface version can be fetched calling the root endpoint of DataService:
GET /rawdataServiceRest/ HTTP/1.1
{"supportedVersions":["1.4.0"]}
Interface information returns the highest available minor version of each major version. This lets the user decide which features can be used. As a minor version is backwards compatible to all previous minor versions, there is no point in enumerating them all. A user wants to know which revision of each major version is available as that means they can work around possible bugs of older revisions.
The service information can be fetched via the following endpoint. This endpoint doesn’t provide filter parameters.
GET /rawdataServiceRest/serviceInformation HTTP/1.1
{
"version": "7.8.0.0"
}
You can can fetch information about raw data objects by using the following endpoints.
Returns a list of raw data file information entries for all entities with type :entity. You further have to and restrict the request to the entities’ uuids by adding the following uri parameter:
Parameter name | Description Example |
---|---|
uuids |
Restricts the query to the entities identified by the given uuids. ![]() uuids={652ae7a0-d1e1-4ee2-b3a5-d4526f6ba822|78bd15c6-dc70-4ab4-bd3c-8ab2b5780b52} |
filter |
Contains one or multiple attribute conditions to restrict the query. Details can be found below. |
Filter syntax
Basic module is expression <attribute> <operator> <value>
or <attribute> <list operator> (<value1>, <value2>, ...)
Possible <attribute> values | Description |
---|---|
MimeType |
MimeType of raw data object |
FileName |
File name of raw data object |
LastModified |
Date of last change made to raw data object |
Created |
Date of creation of raw data object |
Length |
Size of raw data object in bytes |
MD5 |
Check sum of raw data object |
Possible <operator> values | Description |
---|---|
eq |
Checks if attribute equals <value> |
ne |
Checks if attribute is not equal to <value> |
lt |
Checks if attribute is lower than <value> |
le |
Checks if attribute is equal or lower than <value> |
gt |
Checks if attribute is greater than <value> |
ge |
Checks if attribute is equal or greater than <value> |
like |
Compares attribute with a wildcard string. Character ‘*’ represents any number of any characters. Character ‘?’ represents exactly one of any characters. If you want to use one of these wildcard characters within a filter expression use ‘' to mask it. Use ‘' to mask ‘' as well. Use of like operator is only available for string attributes. |
Possible <List operator> values | Description |
---|---|
in |
Checks if attribute exists in a list of values |
notin |
Checks if attribute does not exist in a list of values |
<Value> can be formatted differently and needs to match type of attribute:
'Some Value'
or 'This string contains a single '' character.'
.'2018-01-21T16:12:30+01:00'
'-<Offset>[mhdwMy]'
where m = minutes, h = hours, d = days, w = weeks, M = months, y = years, e.g. ‘-1w’ or ‘-5d’Value list (<Value1>, <Value2>, …) contains any number of elements which need to meet the conditions described in above
Attribute conditions can be combined by logical operators and
, or
or not
:
<Condition1> and <Condition2>
<Condition1> or <Condition2>
not <Condition1>
Examples:
Filename like '*.txt' or MimeType eq 'text/plain'
Length lt 5000
(MimeType like 'text/* or Filename like '*.txt') and Length lt 5000
not MimeType like 'text/*'
Filename in ('some_file.txt', 'some_other_file.html')
GET /rawDataServiceRest/rawDataInformation/part?uuids={05040c4c-f0af-46b8-810e-30c0c00a379e,5441c003-b6db-4217-ac6a-45cdbb805bb3}&filter=fileName%20like%20'*meshModel*' HTTP/1.1
[
{
"target":
{
"entity": "Part",
"uuid": "05040c4c-f0af-46b8-810e-30c0c00a379e"
},
"key": 0,
"fileName": "section view.meshModel",
"mimeType": "application/x-zip-compressed",
"lastModified": "2012-11-19T10:48:34.327Z",
"created": "2012-11-19T10:48:34.327Z",
"size": 147376,
"md5": "02f9c861-43ea-176c-06e2-4524385b5907"
},
{
"target":
{
"entity": "Part",
"uuid": "5441c003-b6db-4217-ac6a-45cdbb805bb3"
},
"key": 0,
"fileName": "cad_22.meshModel",
"mimeType": "application/x-zeiss-piweb-meshmodel",
"lastModified": "2015-03-20T14:37:02.943Z",
"created": "2015-03-20T14:37:02.943Z",
"size": 837245,
"md5": "cbde88e2-ed75-4c70-860b-3e6d4313551a"
}
]
GET /rawDataServiceRest/rawDataInformation/part/05040c4c-f0af-46b8-810e-30c0c00a379e HTTP/1.1
[
{
"target":
{
"entity": "Part",
"uuid": "05040c4c-f0af-46b8-810e-30c0c00a379e"
},
"key": 0,
"fileName": "section view.meshModel",
"mimeType": "application/x-zip-compressed",
"lastModified": "2012-11-19T10:48:34.327Z",
"created": "2012-11-19T10:48:34.327Z",
"size": 147376,
"md5": "02f9c861-43ea-176c-06e2-4524385b5907"
}
]
Update raw data information when you want to:
An update request consists of 2 mandatory parts:
PUT /rawDataServiceRest/rawDataInformation/part/f8343266-188e-4d2e-abf9-f0cbba4ac7c7/1 HTTP/1.1
{
"filename": "metal part.jpg",
"mimeType": "text/plain"
}
HTTP/1.1 200 Ok
The returned objects contains the following properties:
Property | Description |
---|---|
TargetEntity target |
Specifies a concrete entity for a raw data object and consits of the entity’s type (Part, Characteristic, Measurement, Value) and guid. If raw data is attached to an entity of type Value , the uuid contains a compound key in the following format: {MeasurementUuid}|{CharacteristicUuid} |
int key |
This is a unique key that identifies this specific raw data object for a corresponding entity. An entity can have multiple raw data object that are distinct by this key. |
string fileName |
The filename of the raw data object. Please note that this filename is not unique (unlike filenames in traditional file systems). |
string mimeType |
The file’s mime type. |
DateTime lastModified |
The timestamp of the last modification of the corresponding raw data object |
DateTime created |
The timestamp of the creation of the corresponding raw data object |
int size |
The size of the raw data object in bytes |
string md5 |
The MD5-Hash of the raw data object |
You can can fetch, create, update and delete raw data objects by using the following endpoints.
The server caches raw data fetch requests. When you request a raw data file for the first time the response will contain the file itself and several HTTP headers. One of these headers is the ETag header. An ETag is a unique hash value to identify the file. It is a combination of the file’s MD5 checksum and the last modification date. If you send the ETag value in the If-None-Match header, the server can respond two different ways, depending on whether the file has been modified since the last request:
GET /rawDataServiceRest/rawData/part/b8f5d3fe-5bd5-406b-8053-67f647f09dc7/0 HTTP/1.1
GET /rawDataServiceRest/rawData/part/b8f5d3fe-5bd5-406b-8053-67f647f09dc7/0 HTTP/1.1
If-None-Match: "6ab0f6bd01b30aa8e55021085b820393635437006830400000"
HTTP/1.1 200 OK
Etag: "6ab0f6bd01b30aa8e55021085b820393635437006830400000"
Last-Modified: Fri, 15 Aug 2014 11:58:03 GMT
...
The requested raw data file
HTTP/1.1 304 Not modified
GET /rawDataServiceRest/rawData/part/b8f5d3fe-5bd5-406b-8053-67f647f09dc7/1/thumbnail HTTP/1.1
HTTP/1.1 200 OK
The requested thumbnail
You can attach files to all entity types: parts, characteristics, measurements and measured values.
An add request consists of 3 mandatory parts:
HTTP header variable | Description | Example Value |
---|---|---|
Content-Disposition | Includes the file name | “MetalPart.meshModel” |
Content-Length | Includes the length in bytes | 2090682 |
Content-Type | Includes file’s MIME type | “application/x-zeiss-piweb-meshmodel” |
Content-MD5 | (optional) Includes file’s MD5 hash sum in Base64 format | “vfawarMBqArlUCEIW4IDkw==” |
The allowed raw data file names (see
Content-Disposition
) can be restricted on the server.
When adding a file, you can pass the desired file key as part of the uri. If you pass -1 or no key, the next available key will automatically be assigned by the server (recommended) and can be read from the result.
If you pass a key which is already assigned to another file, this file will be replaced.
Remember, when adding a file for a measured value, you need to specify the target uuid in a compound format of measurementUuid|characteristicUuid, instead of one single uuid.
POST /rawDataServiceRest/rawData/part/b8f5d3fe-5bd5-406b-8053-67f647f09dc7 HTTP/1.1
Content-Disposition: "MetalPart.meshModel"
Content-Length: 2090682
Content-MD5: "vfawarMBqArlUCEIW4IDkw=="
Content-Type: "application/x-zeiss-piweb-meshmodel"
HTTP/1.1 201 Created
{
"target":
{
"entity": "Part",
"uuid": "b8f5d3fe-5bd5-406b-8053-67f647f09dc7"
},
"key": 0,
"fileName": "MetalPart.meshModel",
"mimeType": "application/x-zip-compressed",
"lastModified": "2012-11-19T10:48:34.327Z",
"created": "2012-11-19T10:48:34.327Z",
"size": 2090682,
"md5": "6ab0f6bd-01b3-0aa8-e550-21085b820393"
}
An update request consists of 3 mandatory parts:
HTTP header variable | Description | Example Value |
---|---|---|
Content-Disposition | Includes the file name | “MetalPart.meshModel” |
Content-Length | Includes the length in bytes | 2090682 |
Content-Type | Includes file’s MIME type | “application/x-zeiss-piweb-meshmodel” |
Content-MD5 | (optional) Includes file’s MD5 hash sum in Base64 format | “vfawarMBqArlUCEIW4IDkw==” |
The allowed raw data file names (see
Content-Disposition
) can be restricted on the server.
PUT /rawDataServiceRest/rawData/part/b8f5d3fe-5bd5-406b-8053-67f647f09dc7/1 HTTP/1.1
Content-Disposition: "MetalPart.meshModel"
Content-Length: 2090682
Content-MD5: "vfawarMBqArlUCEIW4IDkw=="
Content-Type: "application/x-zeiss-piweb-meshmodel"
HTTP/1.1 200 Ok
DELETE /rawDataServiceRest/rawData/part/b8f5d3fe-5bd5-406b-8053-67f647f09dc7 HTTP/1.1
HTTP/1.1 200 OK
DELETE /rawDataServiceRest/rawData/part/b8f5d3fe-5bd5-406b-8053-67f647f09dc7/0 HTTP/1.1
HTTP/1.1 200 OK
The RawDataService offers special endpoints to work with archives, including the possibility to list contents of an archive which is saved as raw data on any target entity, or retrieving only specified files of an archive instead of requesting the whole archive. This can save time and data if you only need a small portion of an archive.
Archive lookup currently works with archives of filetype
.zip
You can fetch information about the archive and included files. In this example the ExampleArchive.zip contains three files as listed in “entries”: information.txt, metal_part.meshModel and thumbnail.jpg.
GET /rawDataServiceRest/rawData/part/db42f331-1a22-491b-b20f-1dc52a40cec7/1/ArchiveEntries HTTP/1.1
[
{
"archiveInfo": {
"target": {
"entity": "Part",
"uuid": "db42f331-1a22-491b-b20f-1dc52a40cec7"
},
"key": 1,
"fileName": "ExampleArchive.zip",
"mimeType": "application/x-zip-compressed",
"lastModified": "2020-12-17T10:35:49.017Z",
"created": "2020-12-17T10:35:49.017Z",
"size": 2206767,
"md5": "9c5574b3-88f6-4e39-c4cd-4319db285c9c"
},
"entries": [
"information.txt",
"metal_part.meshModel",
"thumbnail.jpg"
]
}
]
The returned object contains the following properties:
Property | Description |
---|---|
RawDataInformation archiveInfo |
Information about the raw data which is an archive, the same properties as Raw Data Information. |
string[] entries |
A list of all files inside the archive, including subfolders. |
As archives can contain subfolders, the structure is present in the filename.
[
{
"archiveInfo": { . . . },
"entries": [
"metal_part.meshModel",
"Subfolder/",
"Subfolder/information.txt",
"thumbnail.jpg"
]
}
]
Since folders are also entries from the point of view of the archive, they are part of the response like Subfolder/ in above example.
Please note that these entries do not contain data, so requesting the entry Subfolder/ will result in HTTP status code 200 - OK
, but without data in the response body.
You will not receive the folders content. For this you need to explicitly fetch the files located in the subfolder with their full name, including folder structure, as shown in the next endpoint.
Once you know the contents of specified archive you can request single files with a GET request similiar to fetching normal raw data. You specify the raw data archive with :entity, :uuid and :key, and the requested file with its :filename. This endpoint offers the same caching mechanisms as the normal request for raw data.
The filename is case insensitive. Archive lookup will return the first occurence of specified file if two files with the same name exist in the same folder.
Parameter name | Description Example |
---|---|
filename |
The filename of a file which is part of specified archive, e.g. information.txt. The filename includes folder structure if the file is located in some subfolder, e.g. Subfolder/information.txt. |
GET /rawDataServiceRest/rawData/part/db42f331-1a22-491b-b20f-1dc52a40cec7/1/ArchiveContent/information.txt HTTP/1.1
The requested file
You can request information and file lists for more than one archive at a time using this query endpoint.
The property selectors
can contain any number of raw data targets and the key of the raw data archive.
POST /rawDataServiceRest/rawData/ArchiveEntryQuery HTTP/1.1
{
"selectors": [
{
"target": {
"entity": "Part",
"uuid": "db42f331-1a22-491b-b20f-1dc52a40cec7"
},
"key": 1
},
{
"target": {
"entity": "Characteristic",
"uuid": "b8f5d3fe-5bd5-406b-8053-67f647f09dc7"
},
"key": 4
},
]
}
[
{
"archiveInfo": {
"target": {
"entity": "Part",
"uuid": "db42f331-1a22-491b-b20f-1dc52a40cec7"
},
"key": 1,
"fileName": "ExampleArchive.zip",
"mimeType": "application/x-zip-compressed",
"lastModified": "2020-12-17T10:35:49.017Z",
"created": "2020-12-17T10:35:49.017Z",
"size": 2206767,
"md5": "9c5574b3-88f6-4e39-c4cd-4319db285c9c"
},
"entries": [
"information.txt",
"metal_part.meshModel",
"thumbnail.jpg"
]
},
{
"archiveInfo": {
"target": {
"entity": "Characteristic",
"uuid": "b8f5d3fe-5bd5-406b-8053-67f647f09dc7"
},
"key": 4,
"fileName": "ExampleArchive_Subfolder.zip",
"mimeType": "application/x-zip-compressed",
"lastModified": "2020-12-17T14:17:53.587Z",
"created": "2020-12-17T14:17:53.587Z",
"size": 2206919,
"md5": "8e51ba7a-b63d-5066-e2a0-c03abc73261a"
},
"entries": [
"metal_part.meshModel",
"Subfolder/",
"Subfolder/information.txt",
"thumbnail.jpg"
]
}
]
You can fetch multiple files of the same or different archives using the ArchiveContentQuery
endpoint.
The property selectors
contains the same information as the ArchiveEntryQuery
above, with an additional list of requested files per raw data archive.
POST /rawDataServiceRest/rawData/ArchiveContentQuery HTTP/1.1
{
"selectors": [
{
"target": {
"entity": "Part",
"uuid": "db42f331-1a22-491b-b20f-1dc52a40cec7"
},
"key": 1,
"entries": [
"information.txt",
"thumbnail.jpg"
]
}
]
}
The requested files in BSON format.
The BSON contains one entry for each requested file, with no separation between files of different raw data archives. Each entry contains
the property archiveInfo
, which again has the same structure as Raw Data Information. The entry can be identified by its
fileName
and is completed by the actual data
, the size
and an md5
checksum.
You can add more targets to selectors
to fetch files from different archives:
{
"selectors": [
{
"target": { . . . },
"key": 1, //Archive 1
"entries": [ . . . ]
},
{
"target": { . . . },
"key": 4, //Archive 2
"entries": [ . . . ]
},
{
"target": { . . . },
"key": 325, //Archive 3
"entries": [ . . . ]
}
]
}
Archive lookup only works with supported archives, currently the .zip format. If you try to list or fetch contents of raw data in any other format you will receive HTTP status code 400 - BadRequest
and the following response:
{
"Message": "Specified RawData is no archive of supported format!",
"ExceptionType": "System.InvalidOperationException",
"StackTrace": " . . . "
}
The PiWeb Server offers functionality for clients to be asynchronously notified of certain events, e.g. creation of raw data, using SignalR. A C# sample application using the PiWeb Server events endpoint can be found in the PiWeb-Training Project on GitHub.
Information and tutorials for different client technologies like .NET, JavaScript or Java can be found in the SignalR client documentation.
The events endpoint can be found under the route http(s)://serverHost:port/events
. The endpoint is not part of the RawDataServiceRest, since it is able to send events for other parts of PiWeb, e.g. the DataServiceRest.
The following listing contains all events available for the entities managed using the DataServiceRest as well as the provided information in the events.
You will only receive events for entities with corresponding permissions assigned to your user.
Event Type | Property | Description |
---|---|---|
Created | int Key string TargetUuid string RawDataEntitystring Filename |
The raw data key The unique identifier of the inspection plan entity (part, characteristic, measurement, value) where the new raw data was added to. Remarks: Raw data of values use a compound UUID in the form of MeasurementUuid|CharacteristicUuid. The type of target entity (part, characteristic, measurement, value). The file name of the raw data. |
Modified | int Key string TargetUuid string RawDataEntity string OldFilename string NewFilename |
The raw data key The unique identifier of the inspection plan entity (part, characteristic, measurement, value) where the raw data was modified. Remarks: Raw data of values use a compound UUID in the form of MeasurementUuid|CharacteristicUuid. The type of target entity (part, characteristic, measurement, value). The old file name of the raw data before modification. The new file name of the raw data after modification. |
Deleted | int Key string TargetUuid string RawDataEntity string Filename |
The raw data key The unique identifier of the inspection plan entity (part, characteristic, measurement, value) where the new raw data was removed from. Remarks: Raw data of values use a compound UUID in the form of MeasurementUuid|CharacteristicUuid. The type of target entity (part, characteristic, measurement, value). The file name of the deleted data. |