Skip to content

[API] Behaviour of GetFileByPath with (external) files #495

@TomGneuss

Description

@TomGneuss

In this issue we discussed the behaviour of the GetFileByPath() method. There appear to be different expectations how a server should handle this endpoint.

Situation:
A server (e.g., SM-Service) provides API access to a SM. The SM has some SME of subtype "File". The value field contains the file path and name. The path points to some remote file, i.e., it starts with http://....
An API client requests the file via the GetFileByPath() endpoint (GET [...]\attachment).

Question:
How should the server behave?
(1) Respond with an error, since it cannot find the file in its database.
(2) Silently pull the file from the remote location and deliver it to the client. Caching is optional.

Proposal:
IMO, option (2) is more transparent and therefore should be the prefered one. The client should not be bothered with analyzing the value field first.

Bigger picture:
How are file paths expected to work on API servers anyway? It is not like they need to be absolute or relative local paths. For obvious security reasons, these paths should not in any way correspond to the local file system of the server. That being said, the value field would contain just file names - they may contain the / character but it does not necessarily imply any meaning for directory navigation. Rather , it merely serves for logical structuring and hierarchy to put the name into context. The directory meaning may be given back when exporting as AASX.

The specification lists examples like file:c:/local/Specification.pdf for the PathType in the "File" class. Since the AAS is meant for information exchange, this has no value of the recipient of the information - not even in the case of AASX packages.

Would a restriction in the specification help? It could clearly distinguish between local files starting with file: (the server may store them however feasible, directory notions using / are evaluated relative to the AASX root) and remote ones starting with http:// or ftp:// .

Interested in your opinions and a lively discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions