assistedservicewebservices Extension

The assistedservicewebservices extension has web calls to expose Assisted Service Module functionality to external systems through web services.

About the Extension

Name

Directory

Related Module
assistedservicewebservices

hybris/bin/assisted-services

Assisted Service Module
ASM webservices allow the agent to get CustomerLists, list of customers inside them, and customer emulating functionality. We use the OCC layer to achieve the commerce functionality on behalf of a customer through web services. The AS agent needs to log in with their credentials to retrieve the OAuth2 token. The emulated customer userID is taken from the request path. If the userID is not present in the request path, it's taken from the sap-commerce-cloud-user-id header.

For information about module's API, see Accessing the assistedservicewebservices API.

Dependencies

Controllers

Name

Description

Required Parameters

CustomerListsController

Controller orchestrating returning customer lists.

baseSite

CustomersController

Controller orchestrating returning customers.

baseSite

For more detailed description of the controllers, see the assistedservicewebservices API section.

API Documentation

Logging to OAuth using agent credentials starts the session, during which you can emulate customer account. You use the APIs from assistedservicewebservices extension to identify the customer via name or order number to emulate customer account. Then, you continue to use the ASM agent account to execute OCC calls on behalf of the emulated customer. For example: adding products to the cart, going through the checkout process, or filling in the address details.

See the following table with examples of ASM REST calls:

Description REST calls Example
Authorization as asagent

POST

https://\{host}/authorizationserver/oauth/token

Request
Content-Type: application/x-www-form-urlencoded

Request body: username=<agentName>&password=<agentPwd>&client_secret=<client_secret>&grant_type=password&client_id=<client_name>
Response
Key  
Access_token 1b56d3dc-8eb4-4993-8e18-e9d09ebd4226
Expires_in 43199
Refresh_token 6b10620c-5b9d-448b-903f-705b95b8d75c
Scope basic openid
Token_type bearer
Get the list of available CustomerLists

GET

https://\{host}/assistedservicewebservices/customerlists?baseSite=someSite

Response
Key Value
UserGroups [{"uid":"instoreCustomers"},{"uid":"bopisCustomers"},{"uid":"myRecentCustomerSessions"}]
Get Customers from CustomerList

GET

https://\{host}/assistedservicewebservices/customers/search?customerListId=myRecentCustomerSessions&baseSite=electronics

Response
Key Value
Entries [{"name":"Aaron Customer","uid":"aaron.customer@hybris.com","customerId":"a38e9b45-ad21-44ac-bf99-c7db6f205d45","defaultAddress":{"companyName":"hybris GmbH","country":{"isocode":"JP"},"defaultAddress":false,"email":"aaron.customer@hybris.com","firstName":"Aaron","formattedAddress":"Aizumicho, 1-4-6, Aizumicho, 160-0005","id":"8796094791703","lastName":"Customer","line1":"Aizumicho","line2":"1-4-6","phone":"090 0987 653","postalCode":"160-0005","shippingAddress":true,"town":"Aizumicho","visibleInAddressBook":true},"displayUid":"aaron.customer@hybris.com","firstName":"Aaron","lastName":"Customer"}]
Pagination {"pageSize":20,"sort":"byNameAsc","currentPage":0}
Sorts [{"code":"byNameAsc","selected":true},{"code":"byNameDesc","selected":false}]
Bind an anonymous cart

POST

https://{host}/assistedservicewebservices/bind-cart?

Request
customerId=arron.customer@hybris.com&baseSite=electronics&cartId=00000001
Get suggestions for autocomplete

GET

https://{host}/assistedservicewebservices/customers/customers/autocomplete?baseSite=electronics&customerQuery=ste
Response
[
     {         "email": "keenreviewer10@hybris.com",         "fullName": "Stefan Reviewer",         "date": "22/04/2020",         "card": "----",         "carts": []     }
,
     {         "email": "keenreviewer4@hybris.com",         "fullName": "Steve Reviewer",         "date": "22/04/2020",         "card": "----",         "carts": []     }
]
Get a list of carts

GET

https://{host}/occ/v2/electronics/users/a38e9b45-ad21-44ac-bf99-c7db6f205d45/carts
Response
{"carts": [...]}
Get a list of products

GET

https://{host}/occ/v2/electronics/products/search?fields=products,pagination,sorts&query=:relevance:allCategories:270000&pageSize=10
Response
{"products": [...]}