General objects and attributes

This article describes the general objects used in several APIs.

StatusCode

Used as return status in several calls. May contain any of the below responses.

public static string Ok = "Ok"; // In most cases Ok is the same as not set StatusCode. public static string Error = "Error"; // Will block further steps in the process, message shown to user. public static string Warning = "Warning"; // Will be presented as warning, message shown to user. public static string Information = "Information"; // Message shown to user. public static string Progress = "Progress"; // Not used in APIs public static string Unauthenticated = "Unauthenticated"; // User is not logged in or do not have permission for the operation

Texts returned in calls

In many calls, a text may be returned. This is eg possible when returning an html message, a name of a part or a quantity unit. The logic to extract the text is allow API responder to decide if web viewer data should be used or overridden and to use the highest priority content.

ResolveMode is used to determine if content in API call should be used or the data in the web viewer.

Resolve mode

Meaning

Resolve mode

Meaning

0

Prioritize text from the API response. Fallbacks to text from web viewer  (e.g. if the part exists in the site, take name from there)

1

Prioritize text from the web viewer. Fallbacks to text form API response.

2

Only take text from API response. No fallback.

3

Only take text from web viewer. No fallback.

Priority order is as below.

Priority

Tag

Comment

Priority

Tag

Comment

1

PersistentIdentity

PersistentIdentity of a text. Leave as null if not used.

2

Key

A key text from custom-texts.config or application. Leave as null if not used.

3

Value

A simple text.

HtmlMessage

Used as return message in several calls and content will be shown to user.

"HtmlMessage":{ "ResolveMode":1, // To override messages in WebViewer, eg for overriding a part name. "Value":null, // Message which will be shown to user in simple text "Key":null, // Key for a predefined text in WebViewer "PersistentIdentity":null, // Persistent id for a predefined text in WebViewer "Translations":null, // A list of translations of the message "HtmlEncode":false // Message as html snippet if formatting needed }

Message

Used as return message in several calls, a simple text. Content will be logged.

Attributes

REST providers have a set of general attributes.

Attribute

Usage

Default

Options

Attribute

Usage

Default

Options

trace-folder

Location where trace logs are written on disk

C:\Temp\RESTLog

File path

create-every-day-log-directory

Trace logs are placed in a new folder each day, named with current date.

true

true / false

delete-old-trace-log-after-number-of-folder

Trace logs will be automatically removed. Each date is stored in a separate folder and when X folders exist the oldest gets deleted. Only works if create-every-day-log-directory is true.

30

int

url

Service end point

 

url

media-type

The accepted media type set in the request header.

application/json

 

culture

Force sets the culture (e.g. en-GB) parameter for requests. When not set, culture parameter of request is set using the display culture for user.

 

 

timeout

Sets the timeout (in seconds) for the request

5 (up to version 5.0)

10 (from version 5.1)

int

user-id

Force sets the user id of the request.

 

text

user-name

Force sets the user name of the request.

 

text

authorization-scheme

Sets the authorization scheme for the request.

If any type of authentication credentials is set, the default scheme is Basic

 

authentication-credentials

Sets the authentication credentials for the request. If this is set, authentication-name and authentication-password is not used.

 

 

authentication-name

Sets the authentication credentials name for the request.

 

 

authentication-password

Sets the authentication credentials password for the request.

 

 

permissions

Set a list of permission candidates. Each permission in the list that the user have, is added to the request.

From version 5.0 and later.

 

 

permissions-groups

Set a list of permission groups candidates. Each permission group in the list that the user have, is added to the request.

From version 5.0 and later.

 

 

Example

<PlaceOrderProvider> <RESTPlaceOrderProvider delete-old-trace-log-after-number-of-folder="30" trace-folder="D:\Temp\Trace-logs\" url="https://host/API/" permissions="internal,partner" permission-groups="exclusive" timeout="15"/> </PlaceOrderProvider>