using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
class Trademark
{
// 替换成你的AppKey
private const string AppKey = "YOUR_APPKEY_HERE";
public static async Task DetailAsync(string Regno, int ClassId)
{
try
{
// 构建请求 URL
string url = $"https://api.jisuapi.com/trademark/detail?appkey={AppKey}®no={Regno}&classid={ClassId}";
using (HttpClient client = new HttpClient())
{
// 发送 GET 请求
HttpResponseMessage response = await client.GetAsync(url);
// 确保请求成功,若失败则抛出异常
response.EnsureSuccessStatusCode();
// 读取响应内容
string responseBody = await response.Content.ReadAsStringAsync();
// 解析 JSON 响应内容
JObject jsonarr = JObject.Parse(responseBody);
// 检查响应状态码
if (jsonarr["status"] != null && (int)jsonarr["status"] != 0)
{
if (jsonarr["msg"] != null)
{
// 若状态码非 0,输出错误信息
Console.WriteLine(jsonarr["msg"]);
}
return;
}
// 获取结果对象
JObject result = (JObject)jsonarr["result"];
if (result != null)
{
// 输出商标基本信息
Console.WriteLine($"{result["regno"]} {result["classid"]} {result["appdate"]} {result["firsttrialno"]} {result["firsttrialdate"]} " +
$"{result["announceno"]} {result["announcedate"]} {result["startdate"]} {result["enddate"]} " +
$"{result["iscommon"]} {result["type"]} {result["pic"]} {result["agent"]} {result["status"]} " +
$"{result["name"]} {result["registrant"]} {result["idcard"]} {result["address"]}");
// 输出商品列表信息
JArray productList = (JArray)result["productlist"];
if (productList != null)
{
foreach (JObject val in productList)
{
Console.WriteLine($"{val["classid"]} {val["name"]}");
}
}
// 输出流程列表信息
JArray processList = (JArray)result["processlist"];
if (processList != null)
{
foreach (JObject val in processList)
{
Console.WriteLine($"{val["name"]} {val["date"]}");
}
}
}
}
}
catch (HttpRequestException ex)
{
// 处理 HTTP 请求异常
Console.WriteLine($"请求出错: {ex.Message}");
}
catch (Exception ex)
{
// 处理其他异常
Console.WriteLine($"发生错误: {ex.Message}");
}
}
public static async Task Main()
{
// 调用商标搜索方法
await Trademark.SearchAsync("手机");
// 调用商标详情查询方法
await Trademark.DetailAsync("4952050", 42);
}
}


© 2015-2025 杭州极速互联科技有限公司 版权所有 浙ICP备17047587号-4 浙公网安备33010502005096 增值电信业务经营许可证:浙B2-20190875