HTTP/HTTPS
请求协议
APIUSB / 平台接口 / 添加会员收货地址
添加会员收货地址
接口地址:https://api.apiusb.com/api/platform?s=Platform.MemberAddress.Add
接口描述: 添加会员收货地址
接口参数
参数名字 | 类型 | 是否必须 | 默认值 | 其他 | 说明 |
---|---|---|---|---|---|
access_token | 字符串 | 可选 | 访问令牌,仅当开启签名验证时需要传递,生成令牌可使用App.Auth.ApplyToken接口 | ||
member_id | 整型 | 可选 | 会员ID | ||
address_name | 字符串 | 可选 | - | 最大:200 | 地址别名,例如:家里、公司、学校、父母家 |
address_details | 字符串 | 可选 | - | 最大:1000 | 详细地址,完整的详细地址 |
provinces | 整型 | 可选 | 0 | 省份id | |
city | 整型 | 可选 | 0 | 城市id | |
area | 整型 | 可选 | 0 | 区县id | |
zip_code | 字符串 | 可选 | - | 最大:10 | 邮编 |
realname | 字符串 | 可选 | - | 最大:100 | 真实姓名 |
mobile | 字符串 | 可选 | - | 最大:20 | 手机号码 |
home_phone | 字符串 | 可选 | - | 最大:20 | 家庭号码 |
字符串 | 可选 | - | 最大:100 | 邮箱地址 |
返回字段
返回结果 | 类型 | 说明 |
---|---|---|
ret | 整型 | 状态码,200表示成功,4xx表示客户端非法请求,5xx表示服务器错误 |
data | 对象或混合类型 | 业务数据,由各自接口指定,通常为对象 |
data.id | 整型 | 收货地址ID |
msg | 字符串 | 提示信息,失败时的错误提示 |
在线测试
参数 | 是否必须 | 值 |
---|---|---|
service | 必须 | |
access_token | 可选 | |
member_id | 可选 | |
address_name | 可选 | |
address_details | 可选 | |
provinces | 可选 | |
city | 可选 | |
area | 可选 | |
zip_code | 可选 | |
realname | 可选 | |
mobile | 可选 | |
home_phone | 可选 | |
可选 |
客户端请求示例
{
"ret": 200,
"data": {
"id": "6"
},
"msg": ""
}
curl https://api.apiusb.com/api/platform?s=Platform.MemberAddress.Add&member_id=7&address_name=hello word
&address_details=金成时代广场
&provinces=河南
&city=郑州
&area=高新区
&zip_code=450000
&realname=张三
&mobile=15515111258
&home_phone=03715555555
&email=3654784@qq.com
{
"ret": 200,
"data": {
"id": "6"
},
"msg": ""
}
$.ajax({
url: "https://api.apiusb.com/api/platform",
data: {s: "Platform.MemberAddress.Add",
member_id: 7,
address_name: "公司",
address_details: "金成时代广场",
provinces: "河南",
city: "郑州",
area: "高新区",
zip_code: "450000",
realname: "张三",
mobile: "15515111258",
home_phone: "03715555555",
email: "3654784@qq.com"
},
dataType: 'json',
success: function (response, status, xhr) {
console.log(response);
}
});
<?php
require_once dirname(__FILE__) . '/PhalApiClient.php';
$client = PhalApiClient::create()
->withHost('https://api.apiusb.com/api/platform');$rs = $client->reset()
->withService('Platform.MemberAddress.Add')
->withParams("chat_message_data", "hello word")
->withParams("member_id", 7)
->withParams("address_name", "公司")
->withParams("address_details", "金成时代广场)
->withParams("provinces", "河南")
->withParams("city", "郑州")
->withParams("area", "高新区")
->withParams("zip_code", 450000)
->withParams("realname", "张三")
->withParams("mobile", "15515111258")
->withParams("home_phone", "03715555555")
->withParams("email", "3654784@qq->com")
->withTimeout(3000)
->request();
// ret状态码,200表示成功
var_dump($rs->getRet());
// 业务数据
var_dump($rs->getData());
// 提示信息
var_dump($rs->getMsg());
#-*- coding:utf-8 -*-
import PhalApiClient
result = PhalApiClient.PhalApiClient('https://api.apiusb.com/api/platform', 'Platform.MemberAddress.Addx', {
'member_id': 7,
'address_name': "公司",
'address_details': "金成时代广场",
'provinces': "河南",
'city': "郑州",
'area': "高新区",
'zip_code': "450000",
'realname': "张三",
'mobile': "15515111258",
'home_phone': "03715555555",
'email': "3654784@qq.com"
}, 3)
//FullscreenActivity.java
import net.phalapi.sdk.*; /**
* 网络操作相关的子线程
*/
Runnable networkTask = new Runnable() {
@Override
public void run() {
// TODO
// 在这里进行 http request.网络请求相关操作
PhalApiClient client = PhalApiClient.create()
.withHost("https://api.apiusb.com/api/platform");
PhalApiClientResponse response = client
.withService("Platform.MemberAddress.Add")
.withParams("member_id", 7)
.withParams("address_name", "公司")
.withParams("address_details", "金成时代广场)
.withParams("provinces", "河南")
.withParams("city", "郑州")
.withParams("area", "高新区")
.withParams("zip_code", 450000)
.withParams("realname", "张三")
.withParams("mobile", "15515111258")
.withParams("home_phone", "03715555555")
.withParams("email", "3654784@qq.com")
.withTimeout(3000)
.request();
String content = "";
content += "ret=" + response.getRet() + "\n";
if (response.getRet() == 200) {
try {
JSONObject data = new JSONObject(response.getData());
content += "data.title=" + data.getString("title") + "\n";
content += "data.content=" + data.getString("content") + "\n";
content += "data.version=" + data.getString("version") + "\n";
} catch (JSONException ex) {
}
}
content += "msg=" + response.getMsg() + "\n";
Log.v("[PhalApiClientResponse]", content);
Message msg = new Message();
Bundle data = new Bundle();
data.putString("value", content);
msg.setData(data);
handler.sendMessage(msg);
}
};
PhalApiClientResponse response = PhalApiClient.create()
.withHost("https://api.apiusb.com/api/platform")
.withService("Platform.MemberAddress.Add")
.withparamsList("member_id", 7)
.withparamsList("address_name", "公司")
.withparamsList("address_details", "金成时代广场)
.withparamsList("provinces", "河南")
.withparamsList("city", "郑州")
.withparamsList("area", "高新区")
.withparamsList("zip_code", 450000)
.withparamsList("realname", "张三")
.withparamsList("mobile", "15515111258")
.withparamsList("home_phone", "03715555555")
.withparamsList("email", "3654784@qq.com")
.withTimeout(3000)
.request();
Log.v("response ret", response.ret + "");
Log.v("response data", response.data);
Log.v("response msg", response.msg);
package main
import (
"./PhalApiClient"
"fmt"
"net/url"
)
func main() {
rs, err := PhalApiClient.NewRequest().
WithHost(`https://api.apiusb.com/api/platform`).
WithService("Platform.MemberAddress.Add").
WithParams(url.Values{}).
Get()
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println("code------------------------", rs.Code)
fmt.Println("data------------------------", rs.Data)
fmt.Println("msg------------------------", rs.Msg)
}
}
#import "AFNPhalApiClient.h"// 待POST的参数
NSDictionary *params = @{@"demo_key_1": @"your_key", @"demo_key_2": @"1.0"};
// 使用AFNPhalApiClient
[[[[[AFNPhalApiClient sharedClient] withHost:@"https://api.apiusb.com/api/platform"] withService:@"Platform.MemberAddress.Add"] withParams:params] requestWithFormDataBlock:^(id formData) {
// 如需上传文件(图片等),请参照如下格式
[formData appendPartWithFileData:UIImageJPEGRepresentation([UIImage imageNamed:@"head.JPG"], 1) name:@"file" fileName:@"image.jpg" mimeType:@"image/jpeg"];
} completeBlock:^(id resultObject) {
PALog(@"resultObject: %@", resultObject);
} failureBlock:^(NSError *error) {
PALog(@"error: %@", error);
}];
// 打印url查看
PALog(@"total url: %@", [[AFNPhalApiClient sharedClient] printTotalUrlStr]);
错误列表
错误状态码 | 错误描述信息 |
---|---|
400 | ret=400,客户端参数错误或非法请求 |
404 | 表示接口服务不存在 |
406 | ret=406,access_token令牌校验不通过 |
407 | ret=407,app_key权限不足,或未知应用 |
408 | ret=408,当前用户禁止使用,或用户未登录 |
500 | 表示服务端内部错误 |
本文档生成时间:2024-10-16 10:09:16