---
title: "loadSession"
slug: "api/session/operations/loadsession"
sidebar:
  order: 154
---

<a id="ref-41ea5e5bd0c3"></a>
<a id="ref-dcf6596732bf"></a>
<a id="ref-14986918b380"></a>

## Synopsis

<a id="ref-594a4fed0ec9"></a>

```text
string loadSession(SessionId sessionId,
    string uri,
    LoadSessionOptions* options)
throws SessionServiceFault;

struct LoadSessionOptions {
    string* suffix;
}
```

See also: [SessionId](/pCon/configuratorOnline/specs/api/session/types/sessionid#ref-02e397c8fdb4), [LoadSessionOptions](/pCon/configuratorOnline/specs/api/session/operations/loadsession#ref-594a4fed0ec9), [SessionServiceFault](/pCon/configuratorOnline/specs/api/session/faults/sessionservicefault#ref-30a5c7817f4a)

The `loadSession` operation is used to load a pCon.basket compatible project (OBK) file into the current session.

Instead of a session ID the operation can also be invoked with a session context ID as their first argument (see also §[newSessionContext](/pCon/configuratorOnline/specs/api/session/operations/newsessioncontext#ref-71351064821d)). If so, the session ID stored in the session context will be used as the actual session ID.  When invoked with a session context ID, the operation sets the project key of the session context to the key of the new or loaded project, but never close the session context's old 'current project', regardless of whether it had been identified by a project key stored in the session context or, in the absence of such a key, was (and remains) the session's current project.

On the other hand, if these operations are invoked with a session ID, and if the new project can be created or loaded successfully, then the new project will always become the session's current project, and the old current project is always closed, regardless of whether there is a session context referencing this project. If there is such a session context, operations invoked for this session context will subsequently fail if they require a valid project until the project key of the session context has been reset or is set to the key of one of the projects currently held open by the session.

If the `suffix` option is not specified, the operation uses “.obk” as the suffix of the project file. If the client sets the suffix option to an empty string, then no suffix is appended to the project file name. Otherwise, the Online Configurator checks whether the suffix starts with a dot, prepending one if it does not, and appends the resulting suffix to the project file name.

The client should use an HTTP PUT request with this URL to upload the project file into the session’s working directory. The upload does not actually load the project into the current session.

The client may use an HTTP DELETE request to delete the uploaded file, either before or after it has been loaded into the current session.

If the `uri` argument is not an empty string, it must be one of the following:

- a HTTP URL returned by a previous invocation of the `loadSession` operation on the same session, and uploaded by the client

- a HTTP URL returned by a previous invocation of the [`saveSession`](/pCon/configuratorOnline/specs/api/session/operations/savesession) operation on the same session

- a FILE URL pointing to a file within the local file system of the Online Configurator

The `loadSession` operation loads the project file referenced by the URI into the current session. If the project file could be loaded successfully, the current state of the session is replaced with the state read from the project file. If there was an error, the session’s state is left unchanged.

If the `uri` argument is a FILE URL, The `egr.eai.server.file_access` property of the session or server configuration file must be properly configured (§[Allowed File Access](/pCon/configuratorOnline/specs/guide/configuration/session-start-up-file-options/allowed-file-access#ref-a93b7d824fa6)) or the Online Configurator will reject access to the project file.

The `suffix` option is ignored if the `uri` argument is not an empty string.

A [`SessionServiceFault`](/pCon/configuratorOnline/specs/api/session/faults/sessionservicefault) is returned if one of the following conditions occurs:

- The `sessionId` parameter is not a valid string representation of an UUID or does not represent an open session.

- The `uri` argument is not empty and the syntax of the URI is invalid.

- The `suffix` option is specified (and the `uri` argument is empty), and the suffix contains a character not allowed in file names, or would result in an otherwise invalid file name (like a file name whose length exceeds the maximum length of file names supported by the underlying file system).

- The `uri` argument is not an empty string and the URI is neither an URL returned by a previous invocation of the `loadSession` or [`saveSession`](/pCon/configuratorOnline/specs/api/session/operations/savesession) operations on the same session, nor a FILE URL.

- The FILE URL can not be converted into a path name.

- The server has not been configured to be allowed access to the file referenced by a the FILE URL.

- The Online Configurator encountered some other problem while loading the project file (input/output error, corrupted project file, file system full, …).

- The BSK/OBX stream contains a set-article and the license feature `egr.eai.basket.set_articles` is not enabled.

- After load, the number of items, not counting the top folder and basket sub-article items, is greater than one and the license feature `egr.eai.server.multiple_positions` is not enabled.
