1. Overview

The Script Meta API provides RESTful endpoints to create, read, update, and remove scripts used for virtual attributes.

1.1. Version information

Version : 2.0.0

1.2. URI scheme

Host : localhost:9002
BasePath : /odata2webservices/ScriptService
Schemes : HTTPS

1.3. Tags

  • Metadata : Requests for the metadata which is an Entity Data Model XML (EDMX) schema that describes the entity types and their properties.

  • Scripts : Requests for information about Scripts that exist in the system. Scripts provide the backing logic that controls how a virtual attribute is persisted or retrieved.

1.4. Consumes

  • application/json

1.5. Produces

  • application/json

1.6. External Docs

2. Paths

2.1. View the EDMX document for Script Service Integration Objects.

GET /$metadata

2.1.1. Description

Requests for EDMX documents. The metadata is an Entity Data Model XML (EDMX) document that describes the entity types and their properties.

2.1.2. Responses

HTTP Code Description Schema

200

A valid EDMX schema.

No Content

401

Unauthorized exception responses.

403

Forbidden exception responses.

2.1.3. Produces

  • application/xml

2.1.4. Tags

  • Metadata

2.2. Create/Update Scripts.

POST /Scripts

2.2.1. Description

Creates a new Script or updates an existing Script if a corresponding one is found. For more information about the post behavior see Script Service Examples

2.2.2. Parameters

Type Name Description Schema

Header

Accept-Language
optional

Accept-Language header specifying the language localized data will be returned in.

string

Header

Content-Language
optional

Content-Language header specifying the language localized data will be persisted in.

string

Header

Post-Persist-Hook
optional

The execute method for the PostPersistHook invokes right after the item persists in the SAP Commerce platform. For more details see Persistence Hooks

string

Header

Pre-Persist-Hook
optional

The execute method for the PrePersistHook invokes right before the Integration Object sent in the POST or PATCH request persists in the SAP Commerce platform. For more details see Persistence Hooks

string

Header

integrationMessageId
optional

The integrationMessageId header allows the user to trace any InboundRequest back to the original POST, PATCH or DELETE request.

string

Body

body
required

2.2.3. Responses

HTTP Code Description Schema

201

Indicates the Script has been successfully created/updated.

400

Error occurring during an attempt to create a new Item.

401

Unauthorized exception responses.

403

Forbidden exception responses.

415

Provided Media-Type is not supported

2.2.4. Consumes

  • application/json

2.2.5. Produces

  • application/json

2.2.6. Tags

  • Scripts

2.2.7. Example HTTP response

Response 400
{
  "error" : {
    "code" : "invalid_key",
    "message" : {
      "lang" : "en",
      "value" : "Key [payloadKey] in the payload does not match the key [pathKey] in the path."
    }
  }
}
Response 401
{
  "error" : {
    "code" : "unauthorized",
    "message" : {
      "lang" : "en",
      "value" : "user must be authenticated"
    }
  }
}
Response 403
{
  "error" : {
    "code" : "forbidden",
    "message" : {
      "lang" : "en",
      "value" : "user is not authorized for the operation"
    }
  }
}
Response 415
{
  "error" : {
    "code" : "null",
    "message" : {
      "lang" : "en",
      "value" : "Media type [application/x-www-form-urlencoded] is not supported."
    }
  }
}

2.3. View Scripts.

GET /Scripts

2.3.1. Description

Retrieves Scripts.

2.3.2. Parameters

Type Name Description Schema

Header

Accept-Language
optional

Accept-Language header specifying the language localized data will be returned in.

string

Query

$expand
optional

Specifies navigation properties for associated entries that will be inlined in the response body. By default, these navigation properties are represented as deferred links pointing to the item resource. See $expand

string

Query

$filter
optional

A predicate expression for selecting a subset of the items identified by the resource path. See $filter

string

Query

$inlinecount
optional

Specifies if the total number of items should be included in the response. See $inlinecount

enum (allpages, none)

Query

$skip
optional

The number of matching items to skip over before returning the result set. If skip is larger than the number of matching items then no items will be returned. See $skip

integer (int32)

Query

$top
optional

The maximum number of items to return. If it’s greater than or equal to the number of matching items existing in the platform, then all items will be returned. If it’s less than the number of matching items in the platform, a subset containing top number of items will be returned. See $top

integer (int32)

2.3.3. Responses

HTTP Code Description Schema

200

Retrieved entities.

400

Error responses that may occur due to an exception related to the filter query parameter.

401

Unauthorized exception responses.

403

Forbidden exception responses.

404

An error response that may occur when the requested property is not defined on the Script EntityType.

2.3.4. Produces

  • application/json

2.3.5. Tags

  • Scripts

2.3.6. Example HTTP response

Response 400
{
  "error" : {
    "code" : "integration_key_not_supported",
    "message" : {
      "lang" : "en",
      "value" : "Filtering by integration key is not supported. Please supply the key with the Integration Object (e.g. https://.../ScriptService/Scripts('formatName'))"
    }
  }
}
Response 401
{
  "error" : {
    "code" : "unauthorized",
    "message" : {
      "lang" : "en",
      "value" : "user must be authenticated"
    }
  }
}
Response 403
{
  "error" : {
    "code" : "forbidden",
    "message" : {
      "lang" : "en",
      "value" : "user is not authorized for the operation"
    }
  }
}
Response 404
{
  "error" : {
    "code" : "null",
    "message" : {
      "lang" : "en",
      "value" : "Could not find property with name: 'nonExistingItemPropertyName'."
    }
  }
}

2.4. View an individual Script.

GET /Scripts('{integrationKey}')

2.4.1. Description

Retrieves an Script by its integrationKey.

2.4.2. Parameters

Type Name Description Schema

Header

Accept-Language
optional

Accept-Language header specifying the language localized data will be returned in.

string

Path

integrationKey
required

key: integrationKey

string

Query

$expand
optional

Specifies navigation properties for associated entries that will be inlined in the response body. By default, these navigation properties are represented as deferred links pointing to the item resource. See $expand

string

2.4.3. Responses

HTTP Code Description Schema

200

Retrieved entity.

400

An error occurred because the format of the integrationKey does not match the same format that the EntityType’s integration key format is in.

401

Unauthorized exception responses.

403

Forbidden exception responses.

404

Not Found exception responses for GET operations.

2.4.4. Produces

  • application/json

2.4.5. Tags

  • Scripts

2.4.6. Example HTTP response

Response 400
{
  "error" : {
    "code" : "invalid_key",
    "message" : {
      "lang" : "en",
      "value" : "The integration key [0215Cssss%7C] is invalid. Please consult the IntegrationKey definition of [Script] for configuration details."
    }
  }
}
Response 401
{
  "error" : {
    "code" : "unauthorized",
    "message" : {
      "lang" : "en",
      "value" : "user must be authenticated"
    }
  }
}
Response 403
{
  "error" : {
    "code" : "forbidden",
    "message" : {
      "lang" : "en",
      "value" : "user is not authorized for the operation"
    }
  }
}
Response 404
{
  "error" : {
    "code" : "not_found",
    "message" : {
      "lang" : "en",
      "value" : "[Script] with integration key [formatName] was not found."
    }
  }
}

2.5. Delete an Script.

DELETE /Scripts('{integrationKey}')

2.5.1. Description

Deletes the Script with the corresponding integrationKey.

2.5.2. Parameters

Type Name Description Schema

Header

integrationMessageId
optional

The integrationMessageId header allows the user to trace any InboundRequest back to the original POST, PATCH or DELETE request.

string

Path

integrationKey
required

key: integrationKey

string

2.5.3. Responses

HTTP Code Description Schema

200

Indicates that the Script was successfully deleted.

No Content

400

Error responses that may occur when a DELETE request is made in an attempt to delete an item.

401

Unauthorized exception responses.

403

Forbidden exception responses.

404

Not Found exception responses for GET operations.

2.5.4. Produces

  • application/json

2.5.5. Tags

  • Scripts

2.5.6. Example HTTP response

Response 400
{
  "error" : {
    "code" : "invalid_key",
    "message" : {
      "lang" : "en",
      "value" : "The integration key [0215Cssss%7C] is invalid. Please consult the IntegrationKey definition of [Script] for configuration details."
    }
  }
}
Response 401
{
  "error" : {
    "code" : "unauthorized",
    "message" : {
      "lang" : "en",
      "value" : "user must be authenticated"
    }
  }
}
Response 403
{
  "error" : {
    "code" : "forbidden",
    "message" : {
      "lang" : "en",
      "value" : "user is not authorized for the operation"
    }
  }
}
Response 404
{
  "error" : {
    "code" : "not_found",
    "message" : {
      "lang" : "en",
      "value" : "[Script] with integration key [formatName] was not found."
    }
  }
}

2.6. Update an existing Script.

PATCH /Scripts('{integrationKey}')

2.6.1. Description

Updates the Script with the corresponding integrationKey. For more information about the patch behavior see Script Service Examples

2.6.2. Parameters

Type Name Description Schema

Header

Accept-Language
optional

Accept-Language header specifying the language localized data will be returned in.

string

Header

Content-Language
optional

Content-Language header specifying the language localized data will be persisted in.

string

Header

Post-Persist-Hook
optional

The execute method for the PostPersistHook invokes right after the item persists in the SAP Commerce platform. For more details see Persistence Hooks

string

Header

Pre-Persist-Hook
optional

The execute method for the PrePersistHook invokes right before the Integration Object sent in the POST or PATCH request persists in the SAP Commerce platform. For more details see Persistence Hooks

string

Header

integrationMessageId
optional

The integrationMessageId header allows the user to trace any InboundRequest back to the original POST, PATCH or DELETE request.

string

Path

integrationKey
required

key: integrationKey

string

Body

body
required

2.6.3. Responses

HTTP Code Description Schema

200

Indicates the Script has been successfully updated.

400

Error responses that may occur during an attempt to update an existing Item.

401

Unauthorized exception responses.

403

Forbidden exception responses.

404

Not Found exception responses for GET operations.

415

Provided Media-Type is not supported

2.6.4. Consumes

  • application/json

2.6.5. Produces

  • application/json

2.6.6. Tags

  • Scripts

2.6.7. Example HTTP response

Response 400
{
  "error" : {
    "code" : "invalid_key",
    "message" : {
      "lang" : "en",
      "value" : "Key [payloadKey] in the payload does not match the key [pathKey] in the path."
    }
  }
}
Response 401
{
  "error" : {
    "code" : "unauthorized",
    "message" : {
      "lang" : "en",
      "value" : "user must be authenticated"
    }
  }
}
Response 403
{
  "error" : {
    "code" : "forbidden",
    "message" : {
      "lang" : "en",
      "value" : "user is not authorized for the operation"
    }
  }
}
Response 404
{
  "error" : {
    "code" : "not_found",
    "message" : {
      "lang" : "en",
      "value" : "[Script] with integration key [formatName] was not found."
    }
  }
}
Response 415
{
  "error" : {
    "code" : "null",
    "message" : {
      "lang" : "en",
      "value" : "Media type [application/x-www-form-urlencoded] is not supported."
    }
  }
}

2.7. View count for of all Scripts.

GET /Scripts/$count

2.7.1. Description

Displays the total count of Scripts.

2.7.2. Responses

HTTP Code Description Schema

200

A success response displaying the total count of Scripts.

string

2.7.3. Produces

  • text/plain

2.7.4. Tags

  • Scripts

3. Definitions

3.1. $inlinecount

Type : enum (allpages, none)

3.2. CollectionofScripts

Name Schema

results
optional

< Script > array

3.3. Error

Name Schema

code
required

string

innererror
optional

string

message
required

3.4. Message

Name Schema

lang
optional

string

value
optional

string

3.5. Script

Name Description Schema

autodisabling
optional

Automatically disables a script that fails to execute. The default value is false.
Example : false

boolean

code
optional

TThe script’s unique identifier.
Example : "formatName"

string

content
optional

The code that is executed.
Example : "import de.hybris.platform.core.model.product.ProductModel import org.apache.commons.lang.StringUtils\ndef product = itemModel as ProductModel StringUtils.capitalize(product.getName())"

string

description
optional

Describes what the script is for.
Example : "Formats the name on the Product to generate the Product’s formatName virtual attribute."

string

disable
optional

Disables a script. The default value is false. If the script throws an exception when being executed, it’s marked as disabled = true if autodisabling is enabled.
Example : false

boolean

scriptType
optional

3.6. Script1

Name Schema

d
optional

3.7. ScriptType

Name Description Schema

code
required

The code for script type. Specifies the language in which the script is written. Values can be GROOVY, BEANSHELL or JAVASCRIPT.
Example : "GROOVY"

string

3.8. ScriptsRequest

Name Description Schema

autodisabling
optional

Automatically disables a script that fails to execute. The default value is false.
Example : false

boolean

code
required

TThe script’s unique identifier.
Example : "formatName"

string

content
optional

The code that is executed.
Example : "import de.hybris.platform.core.model.product.ProductModel import org.apache.commons.lang.StringUtils\ndef product = itemModel as ProductModel StringUtils.capitalize(product.getName())"

string

description
optional

Describes what the script is for.
Example : "Formats the name on the Product to generate the Product’s formatName virtual attribute."

string

disable
optional

Disables a script. The default value is false. If the script throws an exception when being executed, it’s marked as disabled = true if autodisabling is enabled.
Example : false

boolean

scriptType
optional

3.9. Wrapper

Name Schema

d
optional

3.10. Wrapper1

Name Schema

d
optional

3.11. errorResponseObj

Name Schema

error
optional

4. Security

4.1. auth

Type : basic