使用SQL Server修改群组的联系人
使用SQL Server修改群组的联系人
SQL Server : API文档
使用SQL Server修改群组的联系人
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO
DECLARE @class varchar(500) = 'group';
DECLARE @method varchar(500) = 'modifycontact';
DECLARE @user varchar(500) = 'user';
DECLARE @password varchar(500) = 'password';
DECLARE @idgroup varchar(500) = '1000';
DECLARE @idcontact varchar(500) = '1000';
DECLARE @contact varchar(500) = 'mobile:123456789,name:testname';
DECLARE @url varchar(255) = 'https://www.afilnet.com/api/http/?class='+@class+'&method='+@method+'&user='+@user+'&password='+@password+'&idgroup='+@idgroup+'&idcontact='+@idcontact+'&contact='+@contact;
DECLARE @win int
DECLARE @hr int
DECLARE @text varchar(8000)
EXEC @hr=sp_OACreate 'WinHttp.WinHttpRequest.5.1',@win OUT
IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
EXEC @hr=sp_OAMethod @win, 'Open',NULL,'GET',@url,'false'
IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
EXEC @hr=sp_OAMethod @win,'Send'
IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
EXEC @hr=sp_OAGetProperty @win,'ResponseText',@text OUTPUT
IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
EXEC @hr=sp_OADestroy @win
IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
参数 | 描述 | 必修/可选 |
---|---|---|
class=group | 要求的课程:要求的课程 | 必修 |
method=modifycontact | 请求的类方法:发出请求的类的方法 | 必修 |
user | 您的Afilnet帐户的用户和电子邮件 | 必修 |
password | 您的Afilnet帐户的密码 | 必修 |
idgroup | 组号 | 必修 |
idcontact | 联络人编号 | 必修 |
contact | 要添加的联系人,其字段用逗号分隔,请参见示例 | 必修 |
发出请求时,您将收到以下字段:
- status
-
结果(如果status = success),您将在此处收到以下值:
- 没有其他值会发送给您
- 错误(如果status = error),在这里您将收到错误代码
下面列出了可能的错误代码
码 | 描述 |
---|---|
MISSING_USER | 不包括用户或电子邮件 |
MISSING_PASSWORD | 不包含密码 |
MISSING_CLASS | 不包括课程 |
MISSING_METHOD | 不包括方法 |
MISSING_COMPULSORY_PARAM | 不包括强制参数 |
INCORRECT_USER_PASSWORD | 用户或密码错误 |
INCORRECT_CLASS | 班级不正确 |
INCORRECT_METHOD | 方法不正确 |
NOT_ACCESS_TO_GROUP | 不允许您进入指定的组 |
参数:
- class : group
- method : modifycontact
- user : user
- password : password
- idgroup : 1000
- idcontact : 1000
- contact : mobile:123456789,name:testname
请求:
https://www.afilnet.com/api/http/?class=group&method=modifycontact&user=user&password=password&idgroup=1000&idcontact=1000&contact=mobile:123456789,name:testname