SAP电商云CCV2 Restful API enablement
时间:2022-07-26
本文章向大家介绍SAP电商云CCV2 Restful API enablement,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
感谢我的同事Zheng Kate的大力帮助。
Attachment 是注册用户的下单流程:
里面用了几个环境变量,你需要设置下, 只是红色部分
使用这个json的前提;
(1) 在hac里面有mobile_android的client, kevin说你知道怎么导入 (2) 在页面上先去注册一个用户 A (3) 在postman的环境变量里把A的user和password和host的值先设置上
导入json后使用:
(1) 第一步获取token,拷贝下,在postman的环境变量里把client_customer的值设置下 (2) Create cart, 生成的cartID,拷贝下,在postman的环境变量里把cartguid的值设置下 (3) 然后按着顺序运行,运行到第7步下单后会生成一个orderid (4) 运行第8步需要改下url里面的orderid就可以了
{
"info": {
"_postman_id": "6b7f9822-6ca0-4c24-a14f-d00a7e8b73b0",
"name": "Reg-PlaceOrder",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "1. auth - client_customer",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "https://{{host}}:9002/authorizationserver/oauth/token?client_id=mobile_android&client_secret=secret&grant_type=password&username={{user}}&password={{password}}",
"protocol": "https",
"host": [
"{{host}}"
],
"port": "9002",
"path": [
"authorizationserver",
"oauth",
"token"
],
"query": [
{
"key": "client_id",
"value": "mobile_android"
},
{
"key": "client_secret",
"value": "secret"
},
{
"key": "grant_type",
"value": "password"
},
{
"key": "username",
"value": "{{user}}"
},
{
"key": "password",
"value": "{{password}}"
}
]
}
},
"response": []
},
{
"name": "2. CreateCart",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "{{trust_credential}}",
"description": "trust_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_credential}}",
"description": "client_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_customer}}",
"description": "client_customer",
"type": "text"
},
{
"key": "Authorization",
"value": "{{client_manager}}",
"description": "client_manager",
"type": "text",
"disabled": true
},
{
"key": "",
"value": "",
"type": "text",
"disabled": true
}
],
"url": {
"raw": "https://{{host}}:9002/rest/v2/electronics/users/{{user}}/carts",
"protocol": "https",
"host": [
"{{host}}"
],
"port": "9002",
"path": [
"rest",
"v2",
"electronics",
"users",
"{{user}}",
"carts"
]
}
},
"response": []
},
{
"name": "3. addProduct",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{trust_credential}}",
"description": "trust_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_credential}}",
"description": "client_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_customer}}",
"description": "client_customer",
"type": "text"
},
{
"key": "Authorization",
"value": "{{client_manager}}",
"description": "client_manager",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "{nt"product": {ntt"code": "779866",ntt"quantity": 1nt}n}"
},
"url": {
"raw": "https://{{host}}:9002/rest/v2/electronics/users/{{user}}/carts/{{cartguid}}/entries",
"protocol": "https",
"host": [
"{{host}}"
],
"port": "9002",
"path": [
"rest",
"v2",
"electronics",
"users",
"{{user}}",
"carts",
"{{cartguid}}",
"entries"
]
}
},
"response": []
},
{
"name": "4. CreateAddress",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "Authorization",
"value": "{{trust_credential}}",
"description": "trust_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_credential}}",
"description": "client_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_customer}}",
"description": "client_customer",
"type": "text"
},
{
"key": "Authorization",
"value": "{{client_manager}}",
"description": "client_manager",
"type": "text",
"disabled": true
},
{
"key": "",
"value": "",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "{n "country": {n "isocode": "AD"n },n "defaultAddress": true,n "firstName": "terry",n "id": "8796552134679",n "lastName": "tan",n "line1": "tianfu",n "line2": "sdas",n "postalCode": "610000",n "titleCode": "mr",n "town": "city"n}nnn"
},
"url": {
"raw": "https://{{host}}:9002/rest/v2/electronics/users/{{user}}/carts/{{cartguid}}/addresses/delivery",
"protocol": "https",
"host": [
"{{host}}"
],
"port": "9002",
"path": [
"rest",
"v2",
"electronics",
"users",
"{{user}}",
"carts",
"{{cartguid}}",
"addresses",
"delivery"
]
}
},
"response": []
},
{
"name": "5. deliveryMode",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{trust_credential}}",
"description": "trust_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_credential}}",
"description": "client_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_customer}}",
"description": "client_customer",
"type": "text"
},
{
"key": "Authorization",
"value": "{{client_manager}}",
"description": "client_manager",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://{{host}}:9002/rest/v2/electronics/users/{{user}}/carts/{{cartguid}}/deliverymode?deliveryModeId=standard-gross",
"protocol": "https",
"host": [
"{{host}}"
],
"port": "9002",
"path": [
"rest",
"v2",
"electronics",
"users",
"{{user}}",
"carts",
"{{cartguid}}",
"deliverymode"
],
"query": [
{
"key": "deliveryModeId",
"value": "standard-gross"
}
]
}
},
"response": []
},
{
"name": "6. accPaymentDetail",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "{{trust_credential}}",
"description": "trust_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_credential}}",
"description": "client_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_customer}}",
"description": "client_customer",
"type": "text"
},
{
"key": "Authorization",
"value": "{{client_manager}}",
"description": "client_manager",
"type": "text",
"disabled": true
},
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{n "accountHolderName": "kate",n "billingAddress": {n "cellphone": "13444444444",n "companyName": "company",n "country": {n "isocode": "CN",n "name": "string"n },n "defaultAddress": true,n "district": "CN-12-1-1",n "email": "k.zheng@sap.com",n "firstName": "string",n "formattedAddress": "string",n "lastName": "string",n "line1": "string",n "line2": "string",n "phone": "12333333333",n "postalCode": "string",n "region": {n "countryIso": "CN",n "isocode": "CN-12",n "isocodeShort": "string",n "name": "string"n },n "shippingAddress": true,n "title": "string",n "titleCode": "mrs",n "town": "CN-12-1",n "visibleInAddressBook": truen },n "cardNumber": "1234567890987654",n "cardType": {n "code": "visa",n "name": "string"n },n "defaultPayment": true,n "expiryMonth": "12",n "expiryYear": "2022"n}"
},
"url": {
"raw": "https://{{host}}:9002/rest/v2/electronics/users/{{user}}/carts/{{cartguid}}/paymentdetails",
"protocol": "https",
"host": [
"{{host}}"
],
"port": "9002",
"path": [
"rest",
"v2",
"electronics",
"users",
"{{user}}",
"carts",
"{{cartguid}}",
"paymentdetails"
]
}
},
"response": []
},
{
"name": "7. accPlaceOrder",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "{{trust_credential}}",
"description": "trust_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_credential}}",
"description": "client_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_customer}}",
"description": "client_customer",
"type": "text"
},
{
"key": "Authorization",
"value": "{{client_manager}}",
"description": "client_manager",
"type": "text",
"disabled": true
}
],
"url": {
"raw": "https://{{host}}:9002/rest/v2/electronics/users/{{user}}/orders?cartId={{cartguid}}&lang=en",
"protocol": "https",
"host": [
"{{host}}"
],
"port": "9002",
"path": [
"rest",
"v2",
"electronics",
"users",
"{{user}}",
"orders"
],
"query": [
{
"key": "cartId",
"value": "{{cartguid}}"
},
{
"key": "lang",
"value": "en"
}
]
}
},
"response": []
},
{
"name": "8. getOrder",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{trust_credential}}",
"description": "trust_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_credential}}",
"description": "client_credential",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "{{client_customer}}",
"description": "client_customer",
"type": "text"
},
{
"key": "Authorization",
"value": "{{client_manager}}",
"description": "client_manager",
"type": "text",
"disabled": true
}
],
"url": {
"raw": "https://{{host}}:9002/rest/v2/electronics/users/{{user}}/orders/00001003",
"protocol": "https",
"host": [
"{{host}}"
],
"port": "9002",
"path": [
"rest",
"v2",
"electronics",
"users",
"{{user}}",
"orders",
"00001003"
]
}
},
"response": []
}
],
"protocolProfileBehavior": {}
}
- 最近处理的几个小问题_20160311 (r8笔记第35天)
- Hibernate_day02总结
- Hibernate_day01总结
- ADG备库批量查询失败的原因分析(r8笔记第33天)
- 通过外部表改进一个繁琐的大查询 (r8笔记第32天)
- 一个简单的bigfile tablespace无法扩展的案例处理 (r8笔记第31天)
- 测试环境的迁移式升级和数据整合(r8笔记第27天)
- 增量数据丢失的原因分析(r8笔记第26天)
- Java全栈开发Spring学习第三天
- 一个oracle bug的简单验证(r8笔记第45天)
- 批量导出csv文件的基本尝试(r8笔记第44天)
- Golang 中的并发限制与超时控制
- 一条简单的报警信息发现的oracle bug(r8笔记第42天)
- 一条insert语句导致的性能问题分析(一)(r8笔记第40天)
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法