跳转至

用户 - 地址

版本:v1

认证方式:Bearer Token

目录

接口列表

获取位置列表

接口说明

根据条件获取位置列表

基本信息

  • 接口名称:获取位置列表
  • 请求方式:GET
  • 请求路径:/UserLocation/{appKey}

请求参数

Path 参数
参数名 示例值 参数描述 是否必填
appKey - -
Query 参数
参数名 类型 示例值 参数描述 是否必填
tag string - 标签
type string - 分类
x number - 纬度
y number - 经度
sphere integer - 附近距离,单位:米
skip integer - 跳过的记录数
take integer 10 获取的记录数

示例代码

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;


public class ApiClient {
    public static void main(String[] args) {
        HttpClient client = HttpClient.newHttpClient();

        HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
            .uri(URI.create("{server}/UserLocation/{appKey}"))
            .header("Authorization", "Bearer {your_access_token}");


        requestBuilder.method("get", HttpRequest.BodyPublishers.noBody());

        try {
            HttpResponse<String> response = client.send(requestBuilder.build(), HttpResponse.BodyHandlers.ofString());
            System.out.println(response.body());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
import requests

url = "{server}/UserLocation/{appKey}"
headers = {
    "Authorization": "Bearer {your_access_token}"
}

response = requests.get(
    url,
    headers=headers
)

print(response.json())
package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
    "bytes"
    "encoding/json"
)

func main() {
    client := &http.Client{}

    var req *http.Request
    var err error

    req, err = http.NewRequest("get", "{server}/UserLocation/{appKey}", nil)
    if err != nil {
        panic(err)
    }

    req.Header.Add("Authorization", "Bearer {your_access_token}")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
const axios = require('axios');

const config = {
    method: 'get',
    url: '{server}/UserLocation/{appKey}',
    headers: {
        'Authorization': 'Bearer {your_access_token}'
    }
};

axios(config)
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error(error);
    });
<?php

$url = "{server}/UserLocation/{appKey}";
$headers = [
    "Authorization: Bearer {your_access_token}"
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "get");

$response = curl_exec($ch);
curl_close($ch);

echo $response;
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Text;
using System.Text.Json;

class Program
{
    static async Task Main()
    {
        using (var client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer {your_access_token}");

            HttpResponseMessage response;
            response = await client.getAsync("{server}/UserLocation/{appKey}");

            var content = await response.Content.ReadAsStringAsync();
            Console.WriteLine(content);
        }
    }
}
require 'net/http'
require 'json'

uri = URI("{server}/UserLocation/{appKey}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::undefined.new(uri)
request["Authorization"] = "Bearer {your_access_token}"

response = http.request(request)
puts response.body
1
2
3
4
5
6
7
8
fetch("{server}/UserLocation/{appKey}", {
    method: "get",
    headers: {
        "Authorization": "Bearer {your_access_token}"
    }
})
.then(response => response.json())
.catch(error => console.error(error));
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import org.json.JSONObject;


public class ApiClient {
    private final OkHttpClient client = new OkHttpClient();

    public void makeRequest() {
        Request.Builder requestBuilder = new Request.Builder()
            .url("{server}/UserLocation/{appKey}")
            .addHeader("Authorization", "Bearer {your_access_token}");
        requestBuilder.method("get", null);

        try (Response response = client.newCall(requestBuilder.build()).execute()) {
            System.out.println(response.body().string());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
import Foundation

let url = URL(string: "{server}/UserLocation/{appKey}")!
var request = URLRequest(url: url)
request.httpMethod = "get"
request.setValue("Bearer {your_access_token}", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let data = data {
        if let json = try? JSONSerialization.jsonObject(with: data) {
            print(json)
        }
    }
}
task.resume()

返回结果

{
    "code": 200          // 状态码,
    "data": {
    "totalLocations": "0",
    "data": [
      {
          "locationName": ""          // 地点的名称,
          "latitude": "0"          // 纬度,
          "longitude": "0"          // 经度,
          "locationType": ""          // 地点的类型,如家庭、工作、学校等,
          "recipientName": ""          // 收货人姓名,
          "phoneNumber": ""          // 收货人联系电话,
          "email": ""          // 收货人电子邮件,
          "country": ""          // 国家,
          "state": ""          // 州/省,
          "city": ""          // 城市,
          "district": ""          // 区/县,
          "street": ""          // 街道,
          "zipCode": ""          // 邮政编码,
          "address": ""          // 详细的地址信息,
          "mapType": ""          // 地址类型,百度、高德、谷歌,
          "remark": ""          // 备注,
          "tags": ""          // 标签,
          "enable": false          // 启用,
          "showIndex": "0"          // 排序,
          "createDate": ""          // 创建时间,
          "lastUpdate": ""          // 最后更新的时间,
          "id": "0"          // ID
      }
    ]
},
    "error": ""          // 错误信息
}
字段名 类型 描述 是否必填
code integer 状态码
data UserLocationsResult -
error string 错误信息

添加位置

接口说明

添加新的位置信息

基本信息

  • 接口名称:添加位置
  • 请求方式:POST
  • 请求路径:/UserLocation/{appKey}

请求参数

Path 参数
参数名 示例值 参数描述 是否必填
appKey - -
Body 参数
参数名 类型 示例值 参数描述 是否必填
locationName string - 地点的名称
latitude number - 纬度
longitude number - 经度
locationType string - 地点的类型,如家庭、工作、学校等
recipientName string - 收货人姓名
phoneNumber string - 收货人联系电话
email string - 收货人电子邮件
country string - 国家
state string - 州/省
city string - 城市
district string - 区/县
street string - 街道
zipCode string - 邮政编码
address string - 详细的地址信息
mapType string - 地址类型,百度、高德、谷歌
remark string - 备注
tags string - 标签
enable boolean - 启用
showIndex integer - 排序
createDate string - 创建时间
lastUpdate string - 最后更新的时间

示例代码

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;


public class ApiClient {
    public static void main(String[] args) {
        HttpClient client = HttpClient.newHttpClient();

        HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
            .uri(URI.create("{server}/UserLocation/{appKey}"))
            .header("Authorization", "Bearer {your_access_token}")
            .header("Content-Type", "application/json");



        // 创建请求体数据
        Map<String, Object> data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};
        ObjectMapper mapper = new ObjectMapper();
        String jsonBody = mapper.writeValueAsString(data);
        RequestBody body = RequestBody.create(
            MediaType.parse("application/json"), jsonBody);

        requestBuilder.method("post", HttpRequest.BodyPublishers.ofString(jsonBody));

        try {
            HttpResponse<String> response = client.send(requestBuilder.build(), HttpResponse.BodyHandlers.ofString());
            System.out.println(response.body());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
import requests

url = "{server}/UserLocation/{appKey}"
headers = {
    "Authorization": "Bearer {your_access_token}",
    "Content-Type": "application/json"
}


data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型如家庭工作学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // /,
    "city": ""          // 城市,
    "district": ""          // /,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型百度高德谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
}

response = requests.post(
    url,
    headers=headers,
    json=data
)

print(response.json())
package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
    "bytes"
    "encoding/json"
)

func main() {
    client := &http.Client{}

    var req *http.Request
    var err error


    data := {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
}
    jsonBody, err := json.Marshal(data)
    if err != nil {
        panic(err)
    }

    req, err = http.NewRequest("post", "{server}/UserLocation/{appKey}", bytes.NewBuffer(jsonBody))
    if err != nil {
        panic(err)
    }
    req.Header.Set("Content-Type", "application/json")

    req.Header.Add("Authorization", "Bearer {your_access_token}")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
const axios = require('axios');


const data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};

const config = {
    method: 'post',
    url: '{server}/UserLocation/{appKey}',
    headers: {
        'Authorization': 'Bearer {your_access_token}',
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error(error);
    });
<?php

$url = "{server}/UserLocation/{appKey}";
$headers = [
    "Authorization: Bearer {your_access_token}",
    "Content-Type: application/json"
];


$data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "post");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);
curl_close($ch);

echo $response;
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Text;
using System.Text.Json;

class Program
{
    static async Task Main()
    {
        using (var client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer {your_access_token}");

            HttpResponseMessage response;


            var data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};
            var content = new StringContent(
                JsonSerializer.Serialize(data),
                Encoding.UTF8,
                "application/json");
            response = await client.postAsync("{server}/UserLocation/{appKey}", content);

            var content = await response.Content.ReadAsStringAsync();
            Console.WriteLine(content);
        }
    }
}
require 'net/http'
require 'json'

uri = URI("{server}/UserLocation/{appKey}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::undefined.new(uri)
request["Authorization"] = "Bearer {your_access_token}"
request["Content-Type"] = "application/json"


data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // /,
    "city": ""          // 城市,
    "district": ""          // /,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
}
request.set_form_data(data)

response = http.request(request)
puts response.body
const data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};

fetch("{server}/UserLocation/{appKey}", {
    method: "post",
    headers: {
        "Authorization": "Bearer {your_access_token}",
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(data)
})
.then(response => response.json())
.catch(error => console.error(error));
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import org.json.JSONObject;


public class ApiClient {
    private final OkHttpClient client = new OkHttpClient();

    public void makeRequest() {
        Request.Builder requestBuilder = new Request.Builder()
            .url("{server}/UserLocation/{appKey}")
            .addHeader("Authorization", "Bearer {your_access_token}")
            .addHeader("Content-Type", "application/json");


        JSONObject data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};
        RequestBody body = RequestBody.create(
            MediaType.parse("application/json"), data.toString());

        requestBuilder.method("post", body);

        try (Response response = client.newCall(requestBuilder.build()).execute()) {
            System.out.println(response.body().string());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
import Foundation

let url = URL(string: "{server}/UserLocation/{appKey}")!
var request = URLRequest(url: url)
request.httpMethod = "post"
request.setValue("Bearer {your_access_token}", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")


let data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
}
let jsonData = try? JSONSerialization.data(withJSONObject: data)
request.httpBody = jsonData

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let data = data {
        if let json = try? JSONSerialization.jsonObject(with: data) {
            print(json)
        }
    }
}
task.resume()

返回结果

1
2
3
4
5
6
7
{
    "code": 200          // 状态码,
    "data": {
    "id": "0"
},
    "error": ""          // 错误信息
}
字段名 类型 描述 是否必填
code integer 状态码
data UserLocationPostResult -
error string 错误信息

获取位置详情

接口说明

根据位置ID获取位置详情

基本信息

  • 接口名称:获取位置详情
  • 请求方式:GET
  • 请求路径:/UserLocation/{appKey}/{id}

请求参数

Path 参数
参数名 示例值 参数描述 是否必填
id - 位置ID
appKey - -

示例代码

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;


public class ApiClient {
    public static void main(String[] args) {
        HttpClient client = HttpClient.newHttpClient();

        HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
            .uri(URI.create("{server}/UserLocation/{appKey}/{id}"))
            .header("Authorization", "Bearer {your_access_token}");


        requestBuilder.method("get", HttpRequest.BodyPublishers.noBody());

        try {
            HttpResponse<String> response = client.send(requestBuilder.build(), HttpResponse.BodyHandlers.ofString());
            System.out.println(response.body());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
import requests

url = "{server}/UserLocation/{appKey}/{id}"
headers = {
    "Authorization": "Bearer {your_access_token}"
}

response = requests.get(
    url,
    headers=headers
)

print(response.json())
package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
    "bytes"
    "encoding/json"
)

func main() {
    client := &http.Client{}

    var req *http.Request
    var err error

    req, err = http.NewRequest("get", "{server}/UserLocation/{appKey}/{id}", nil)
    if err != nil {
        panic(err)
    }

    req.Header.Add("Authorization", "Bearer {your_access_token}")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
const axios = require('axios');

const config = {
    method: 'get',
    url: '{server}/UserLocation/{appKey}/{id}',
    headers: {
        'Authorization': 'Bearer {your_access_token}'
    }
};

axios(config)
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error(error);
    });
<?php

$url = "{server}/UserLocation/{appKey}/{id}";
$headers = [
    "Authorization: Bearer {your_access_token}"
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "get");

$response = curl_exec($ch);
curl_close($ch);

echo $response;
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Text;
using System.Text.Json;

class Program
{
    static async Task Main()
    {
        using (var client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer {your_access_token}");

            HttpResponseMessage response;
            response = await client.getAsync("{server}/UserLocation/{appKey}/{id}");

            var content = await response.Content.ReadAsStringAsync();
            Console.WriteLine(content);
        }
    }
}
require 'net/http'
require 'json'

uri = URI("{server}/UserLocation/{appKey}/{id}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::undefined.new(uri)
request["Authorization"] = "Bearer {your_access_token}"

response = http.request(request)
puts response.body
1
2
3
4
5
6
7
8
fetch("{server}/UserLocation/{appKey}/{id}", {
    method: "get",
    headers: {
        "Authorization": "Bearer {your_access_token}"
    }
})
.then(response => response.json())
.catch(error => console.error(error));
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import org.json.JSONObject;


public class ApiClient {
    private final OkHttpClient client = new OkHttpClient();

    public void makeRequest() {
        Request.Builder requestBuilder = new Request.Builder()
            .url("{server}/UserLocation/{appKey}/{id}")
            .addHeader("Authorization", "Bearer {your_access_token}");
        requestBuilder.method("get", null);

        try (Response response = client.newCall(requestBuilder.build()).execute()) {
            System.out.println(response.body().string());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
import Foundation

let url = URL(string: "{server}/UserLocation/{appKey}/{id}")!
var request = URLRequest(url: url)
request.httpMethod = "get"
request.setValue("Bearer {your_access_token}", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let data = data {
        if let json = try? JSONSerialization.jsonObject(with: data) {
            print(json)
        }
    }
}
task.resume()

返回结果

{
    "code": 200          // 状态码,
    "data": {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
},
    "error": ""          // 错误信息
}
字段名 类型 描述 是否必填
code integer 状态码
data GeoLocationModel -
error string 错误信息

更新位置

接口说明

此方法用于更新指定位置ID的位置信息。如果位置不存在,则创建一个新的位置。

基本信息

  • 接口名称:更新位置
  • 请求方式:PUT
  • 请求路径:/UserLocation/{appKey}/{id}

请求参数

Path 参数
参数名 示例值 参数描述 是否必填
id - 位置ID
appKey - -
Body 参数
参数名 类型 示例值 参数描述 是否必填
locationName string - 地点的名称
latitude number - 纬度
longitude number - 经度
locationType string - 地点的类型,如家庭、工作、学校等
recipientName string - 收货人姓名
phoneNumber string - 收货人联系电话
email string - 收货人电子邮件
country string - 国家
state string - 州/省
city string - 城市
district string - 区/县
street string - 街道
zipCode string - 邮政编码
address string - 详细的地址信息
mapType string - 地址类型,百度、高德、谷歌
remark string - 备注
tags string - 标签
enable boolean - 启用
showIndex integer - 排序
createDate string - 创建时间
lastUpdate string - 最后更新的时间

示例代码

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;


public class ApiClient {
    public static void main(String[] args) {
        HttpClient client = HttpClient.newHttpClient();

        HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
            .uri(URI.create("{server}/UserLocation/{appKey}/{id}"))
            .header("Authorization", "Bearer {your_access_token}")
            .header("Content-Type", "application/json");



        // 创建请求体数据
        Map<String, Object> data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};
        ObjectMapper mapper = new ObjectMapper();
        String jsonBody = mapper.writeValueAsString(data);
        RequestBody body = RequestBody.create(
            MediaType.parse("application/json"), jsonBody);

        requestBuilder.method("put", HttpRequest.BodyPublishers.ofString(jsonBody));

        try {
            HttpResponse<String> response = client.send(requestBuilder.build(), HttpResponse.BodyHandlers.ofString());
            System.out.println(response.body());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
import requests

url = "{server}/UserLocation/{appKey}/{id}"
headers = {
    "Authorization": "Bearer {your_access_token}",
    "Content-Type": "application/json"
}


data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型如家庭工作学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // /,
    "city": ""          // 城市,
    "district": ""          // /,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型百度高德谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
}

response = requests.put(
    url,
    headers=headers,
    json=data
)

print(response.json())
package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
    "bytes"
    "encoding/json"
)

func main() {
    client := &http.Client{}

    var req *http.Request
    var err error


    data := {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
}
    jsonBody, err := json.Marshal(data)
    if err != nil {
        panic(err)
    }

    req, err = http.NewRequest("put", "{server}/UserLocation/{appKey}/{id}", bytes.NewBuffer(jsonBody))
    if err != nil {
        panic(err)
    }
    req.Header.Set("Content-Type", "application/json")

    req.Header.Add("Authorization", "Bearer {your_access_token}")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
const axios = require('axios');


const data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};

const config = {
    method: 'put',
    url: '{server}/UserLocation/{appKey}/{id}',
    headers: {
        'Authorization': 'Bearer {your_access_token}',
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error(error);
    });
<?php

$url = "{server}/UserLocation/{appKey}/{id}";
$headers = [
    "Authorization: Bearer {your_access_token}",
    "Content-Type: application/json"
];


$data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "put");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);
curl_close($ch);

echo $response;
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Text;
using System.Text.Json;

class Program
{
    static async Task Main()
    {
        using (var client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer {your_access_token}");

            HttpResponseMessage response;


            var data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};
            var content = new StringContent(
                JsonSerializer.Serialize(data),
                Encoding.UTF8,
                "application/json");
            response = await client.putAsync("{server}/UserLocation/{appKey}/{id}", content);

            var content = await response.Content.ReadAsStringAsync();
            Console.WriteLine(content);
        }
    }
}
require 'net/http'
require 'json'

uri = URI("{server}/UserLocation/{appKey}/{id}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::undefined.new(uri)
request["Authorization"] = "Bearer {your_access_token}"
request["Content-Type"] = "application/json"


data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // /,
    "city": ""          // 城市,
    "district": ""          // /,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
}
request.set_form_data(data)

response = http.request(request)
puts response.body
const data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};

fetch("{server}/UserLocation/{appKey}/{id}", {
    method: "put",
    headers: {
        "Authorization": "Bearer {your_access_token}",
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(data)
})
.then(response => response.json())
.catch(error => console.error(error));
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import org.json.JSONObject;


public class ApiClient {
    private final OkHttpClient client = new OkHttpClient();

    public void makeRequest() {
        Request.Builder requestBuilder = new Request.Builder()
            .url("{server}/UserLocation/{appKey}/{id}")
            .addHeader("Authorization", "Bearer {your_access_token}")
            .addHeader("Content-Type", "application/json");


        JSONObject data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
};
        RequestBody body = RequestBody.create(
            MediaType.parse("application/json"), data.toString());

        requestBuilder.method("put", body);

        try (Response response = client.newCall(requestBuilder.build()).execute()) {
            System.out.println(response.body().string());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
import Foundation

let url = URL(string: "{server}/UserLocation/{appKey}/{id}")!
var request = URLRequest(url: url)
request.httpMethod = "put"
request.setValue("Bearer {your_access_token}", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")


let data = {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
}
let jsonData = try? JSONSerialization.data(withJSONObject: data)
request.httpBody = jsonData

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let data = data {
        if let json = try? JSONSerialization.jsonObject(with: data) {
            print(json)
        }
    }
}
task.resume()

返回结果

1
2
3
4
5
{
    "code": 200          // 状态码,
    "data": false          // 响应数据,
    "error": ""          // 错误信息
}
字段名 类型 描述 是否必填
code integer 状态码
data boolean 响应数据
error string 错误信息

删除位置

接口说明

根据位置ID删除位置信息

基本信息

  • 接口名称:删除位置
  • 请求方式:DELETE
  • 请求路径:/UserLocation/{appKey}/{id}

请求参数

Path 参数
参数名 示例值 参数描述 是否必填
id - 位置ID
appKey - -

示例代码

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;


public class ApiClient {
    public static void main(String[] args) {
        HttpClient client = HttpClient.newHttpClient();

        HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
            .uri(URI.create("{server}/UserLocation/{appKey}/{id}"))
            .header("Authorization", "Bearer {your_access_token}");


        requestBuilder.method("delete", HttpRequest.BodyPublishers.noBody());

        try {
            HttpResponse<String> response = client.send(requestBuilder.build(), HttpResponse.BodyHandlers.ofString());
            System.out.println(response.body());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
import requests

url = "{server}/UserLocation/{appKey}/{id}"
headers = {
    "Authorization": "Bearer {your_access_token}"
}

response = requests.delete(
    url,
    headers=headers
)

print(response.json())
package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
    "bytes"
    "encoding/json"
)

func main() {
    client := &http.Client{}

    var req *http.Request
    var err error

    req, err = http.NewRequest("delete", "{server}/UserLocation/{appKey}/{id}", nil)
    if err != nil {
        panic(err)
    }

    req.Header.Add("Authorization", "Bearer {your_access_token}")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
const axios = require('axios');

const config = {
    method: 'delete',
    url: '{server}/UserLocation/{appKey}/{id}',
    headers: {
        'Authorization': 'Bearer {your_access_token}'
    }
};

axios(config)
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error(error);
    });
<?php

$url = "{server}/UserLocation/{appKey}/{id}";
$headers = [
    "Authorization: Bearer {your_access_token}"
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "delete");

$response = curl_exec($ch);
curl_close($ch);

echo $response;
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Text;
using System.Text.Json;

class Program
{
    static async Task Main()
    {
        using (var client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer {your_access_token}");

            HttpResponseMessage response;
            response = await client.deleteAsync("{server}/UserLocation/{appKey}/{id}");

            var content = await response.Content.ReadAsStringAsync();
            Console.WriteLine(content);
        }
    }
}
require 'net/http'
require 'json'

uri = URI("{server}/UserLocation/{appKey}/{id}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::undefined.new(uri)
request["Authorization"] = "Bearer {your_access_token}"

response = http.request(request)
puts response.body
1
2
3
4
5
6
7
8
fetch("{server}/UserLocation/{appKey}/{id}", {
    method: "delete",
    headers: {
        "Authorization": "Bearer {your_access_token}"
    }
})
.then(response => response.json())
.catch(error => console.error(error));
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import org.json.JSONObject;


public class ApiClient {
    private final OkHttpClient client = new OkHttpClient();

    public void makeRequest() {
        Request.Builder requestBuilder = new Request.Builder()
            .url("{server}/UserLocation/{appKey}/{id}")
            .addHeader("Authorization", "Bearer {your_access_token}");
        requestBuilder.method("delete", null);

        try (Response response = client.newCall(requestBuilder.build()).execute()) {
            System.out.println(response.body().string());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
import Foundation

let url = URL(string: "{server}/UserLocation/{appKey}/{id}")!
var request = URLRequest(url: url)
request.httpMethod = "delete"
request.setValue("Bearer {your_access_token}", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let data = data {
        if let json = try? JSONSerialization.jsonObject(with: data) {
            print(json)
        }
    }
}
task.resume()

返回结果

1
2
3
4
5
{
    "code": 200          // 状态码,
    "data": false          // 响应数据,
    "error": ""          // 错误信息
}
字段名 类型 描述 是否必填
code integer 状态码
data boolean 响应数据
error string 错误信息

数据结构

BooleanApiResponse

1
2
3
4
5
{
    "code": 200          // 状态码,
    "data": false          // 响应数据,
    "error": ""          // 错误信息
}
字段名 类型 描述 是否必填
code integer 状态码
data boolean 响应数据
error string 错误信息

GeoLocationModel

{
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
}
字段名 类型 描述 是否必填
locationName string 地点的名称
latitude number 纬度
longitude number 经度
locationType string 地点的类型,如家庭、工作、学校等
recipientName string 收货人姓名
phoneNumber string 收货人联系电话
email string 收货人电子邮件
country string 国家
state string 州/省
city string 城市
district string 区/县
street string 街道
zipCode string 邮政编码
address string 详细的地址信息
mapType string 地址类型,百度、高德、谷歌
remark string 备注
tags string 标签
enable boolean 启用
showIndex integer 排序
createDate string 创建时间
lastUpdate string 最后更新的时间

GeoLocationModelApiResponse

{
    "code": 200          // 状态码,
    "data": {
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间
},
    "error": ""          // 错误信息
}
字段名 类型 描述 是否必填
code integer 状态码
data - -
error string 错误信息

GeoLocationResponseModel

{
    "locationName": ""          // 地点的名称,
    "latitude": "0"          // 纬度,
    "longitude": "0"          // 经度,
    "locationType": ""          // 地点的类型,如家庭、工作、学校等,
    "recipientName": ""          // 收货人姓名,
    "phoneNumber": ""          // 收货人联系电话,
    "email": ""          // 收货人电子邮件,
    "country": ""          // 国家,
    "state": ""          // 州/省,
    "city": ""          // 城市,
    "district": ""          // 区/县,
    "street": ""          // 街道,
    "zipCode": ""          // 邮政编码,
    "address": ""          // 详细的地址信息,
    "mapType": ""          // 地址类型,百度、高德、谷歌,
    "remark": ""          // 备注,
    "tags": ""          // 标签,
    "enable": false          // 启用,
    "showIndex": "0"          // 排序,
    "createDate": ""          // 创建时间,
    "lastUpdate": ""          // 最后更新的时间,
    "id": "0"          // ID
}
字段名 类型 描述 是否必填
locationName string 地点的名称
latitude number 纬度
longitude number 经度
locationType string 地点的类型,如家庭、工作、学校等
recipientName string 收货人姓名
phoneNumber string 收货人联系电话
email string 收货人电子邮件
country string 国家
state string 州/省
city string 城市
district string 区/县
street string 街道
zipCode string 邮政编码
address string 详细的地址信息
mapType string 地址类型,百度、高德、谷歌
remark string 备注
tags string 标签
enable boolean 启用
showIndex integer 排序
createDate string 创建时间
lastUpdate string 最后更新的时间
id integer ID

UserLocationPostResult

1
2
3
{
    "id": "0"
}
字段名 类型 描述 是否必填
id integer -

UserLocationPostResultApiResponse

1
2
3
4
5
6
7
{
    "code": 200          // 状态码,
    "data": {
    "id": "0"
},
    "error": ""          // 错误信息
}
字段名 类型 描述 是否必填
code integer 状态码
data - -
error string 错误信息

UserLocationsResult

{
    "totalLocations": "0",
    "data": [
      {
          "locationName": ""          // 地点的名称,
          "latitude": "0"          // 纬度,
          "longitude": "0"          // 经度,
          "locationType": ""          // 地点的类型,如家庭、工作、学校等,
          "recipientName": ""          // 收货人姓名,
          "phoneNumber": ""          // 收货人联系电话,
          "email": ""          // 收货人电子邮件,
          "country": ""          // 国家,
          "state": ""          // 州/省,
          "city": ""          // 城市,
          "district": ""          // 区/县,
          "street": ""          // 街道,
          "zipCode": ""          // 邮政编码,
          "address": ""          // 详细的地址信息,
          "mapType": ""          // 地址类型,百度、高德、谷歌,
          "remark": ""          // 备注,
          "tags": ""          // 标签,
          "enable": false          // 启用,
          "showIndex": "0"          // 排序,
          "createDate": ""          // 创建时间,
          "lastUpdate": ""          // 最后更新的时间,
          "id": "0"          // ID
      }
    ]
}
字段名 类型 描述 是否必填
totalLocations integer -
data array -

UserLocationsResultApiResponse

{
    "code": 200          // 状态码,
    "data": {
    "totalLocations": "0",
    "data": [
      {
          "locationName": ""          // 地点的名称,
          "latitude": "0"          // 纬度,
          "longitude": "0"          // 经度,
          "locationType": ""          // 地点的类型,如家庭、工作、学校等,
          "recipientName": ""          // 收货人姓名,
          "phoneNumber": ""          // 收货人联系电话,
          "email": ""          // 收货人电子邮件,
          "country": ""          // 国家,
          "state": ""          // 州/省,
          "city": ""          // 城市,
          "district": ""          // 区/县,
          "street": ""          // 街道,
          "zipCode": ""          // 邮政编码,
          "address": ""          // 详细的地址信息,
          "mapType": ""          // 地址类型,百度、高德、谷歌,
          "remark": ""          // 备注,
          "tags": ""          // 标签,
          "enable": false          // 启用,
          "showIndex": "0"          // 排序,
          "createDate": ""          // 创建时间,
          "lastUpdate": ""          // 最后更新的时间,
          "id": "0"          // ID
      }
    ]
},
    "error": ""          // 错误信息
}
字段名 类型 描述 是否必填
code integer 状态码
data - -
error string 错误信息

通用错误码

错误码 说明
200 成功