Comments (7)
- Есть два метода
GetDocuments
в объектеDiadocApi
. А поскольку COM не поддерживает перегрузку методов, то в COM-оберткеComDiadocApi
второй метод стал называтьсяGetDocuments_2
. У первого методаGetDocuments
всего два параметра -token
иfilter
.filter
- COM-объектDiadoc.Api.DocumentsFilter
, который содержит в себе на самом деле все те же самые параметры, только их необязательно все заполнять - Поля
Counteragents
в COM-объектеICounteragentList
нет, естьCounteragentsList
, то есть в данном случае должно бытьCounteragentsList.CounteragentsList.Item(s).IndexKey
from diadocapi-docs.
Иначе говоря, есть 2 способа получить документы:
- через метод GetDocuments и 2 параметра (token и filter)
Set filter = CreateObject("Diadoc.Api.DocumentsFilter")
Set DocumentList = diadoc.GetDocuments(token, filter) --> не работает, ошибка: BaseUrl=https://diadoc-api.kontur.ru, PathAndQuery=/V3/GetDocuments?boxId&filterCategory,AdditionalMessage=Could not get boxId&filterCategory,Additional Message=Could not get boxID from boxID query param, StatusCode = BadREquest, DiadocErrorCode:Http.BadRequest
Если указать filter.Boxid = "368....6002"
filter.FilterCategory = "Invoice.InvoiceWaitingForRecipientSignature"
то будет другая ошибка:
BaseUrl=https://diadoc-api.kontur.ru, PathAndQuery=/V3/GetDocuments?boxId=368а119у-22с1-4124-8efa-Additional Message The server encountered an internal error or misconfiguration and was unbale to complete your request, StatusCode=InternalServerError, DiadocErrorCode:
- через метод GetDocuments_2 и несолько параметров?
Set DocumentList = diadoc.GetDocuments_2(token, Boxid, AnyInvoiceDocumentType.InboundFinished, "", "01.01.2016", "01.08.2016", "", "", "", "", "")
Не работает, ошибка --> Object required
from diadocapi-docs.
Скопируйте пожалуйста точные параметры запроса и текст ошибки, которую вы получаете, без сокращений.
from diadocapi-docs.
1 вариант)
Sub API_test()
Dim Key, login, Password, CountINN
Key = Worksheets("Sheet1").Cells(1, 3).Value 'êëþ÷ ðàçðàáîò÷èêà
login = Worksheets("Sheet1").Cells(2, 3).Value
Password = Worksheets("Sheet1").Cells(3, 3).Value
CountINN = Worksheets("Sheet1").Cells(4, 3).Value
Dim i, diadoc, filter, token
i = 2
Set diadoc = CreateObject("Diadoc.Api.ComDiadocApi2")
diadoc.Initialize Key, "https://diadoc-api.kontur.ru"
Set filter = CreateObject("Diadoc.Api.DocumentsFilter")
filter.Boxid = "368f119e-22c1-4124-8efa-c6cfffa06002"
filter.FilterCategory = "Invoice.InvoiceWaitingForRecipientSignature"
token = diadoc.AuthenticateWithPassword(login, Password)
Set DocumentList = diadoc.GetDocuments(token, filter)
End Sub
Ошибка:
Run-time error '-2146233079 (80131509)':
BaseURL=https://diadoc-api.kontur.ru, PathAndQuery=/V3/GetDocuments?boxId=368f119e-22c1-4124-8efa-AdditionalMessage=The server encountered an internal error or misconfiguration and was unable to complete your requestm StatusCode =InternalServerError, DiadocErrorCode:
2 вариант)
Sub API_test()
Dim Key, login, Password, CountINN
Key = Worksheets("Sheet1").Cells(1, 3).Value 'êëþ÷ ðàçðàáîò÷èêà
login = Worksheets("Sheet1").Cells(2, 3).Value
Password = Worksheets("Sheet1").Cells(3, 3).Value
CountINN = Worksheets("Sheet1").Cells(4, 3).Value
Dim i, diadoc, filter, token
i = 2
Set diadoc = CreateObject("Diadoc.Api.ComDiadocApi2")
diadoc.Initialize Key, "https://diadoc-api.kontur.ru"
Set filter = CreateObject("Diadoc.Api.DocumentsFilter")
filter.Boxid = "368f119e-22c1-4124-8efa-c6cfffa06002"
filter.FilterCategory = "Invoice.InvoiceWaitingForRecipientSignature"
token = diadoc.AuthenticateWithPassword(login, Password)
Set DocumentList = diadoc.GetDocuments_2(token, Boxid, AnyInvoiceDocumentType.InboundFinished, "", "01.01.2016", "01.08.2016", "", "", "", "", "")
End Sub
Ошибка:
Run-time error '424':
Object required
from diadocapi-docs.
По поводу CounterAgents: " Поля Counteragents в COM-объекте ICounteragentList нет, есть CounteragentsList , то есть в данном случае должно быть CounteragentsList.CounteragentsList.Item(s).IndexKey " -->
Sub API_test()
Dim Key, login, Password, CountINN
Key = Worksheets("Sheet1").Cells(1, 3).Value 'êëþ÷ ðàçðàáîò÷èêà
login = Worksheets("Sheet1").Cells(2, 3).Value
Password = Worksheets("Sheet1").Cells(3, 3).Value
CountINN = Worksheets("Sheet1").Cells(4, 3).Value
Dim i, diadoc, filter, token
i = 2
Set diadoc = CreateObject("Diadoc.Api.ComDiadocApi2")
diadoc.Initialize Key, "https://diadoc-api.kontur.ru"
token = diadoc.AuthenticateWithPassword(login, Password)
'---------------------------------------------------------------
'Ñîçäàåì îáúåêò DocumentsTask, çàïîëíÿåì ñâîéñòâà, âûïîëíÿåì ìåòîä è ïîëó÷àåì ñïèñîê äîêóìåíòîâ
Dim Organization, Boxid, DocumentsTask, DocumentList, Document
Boxid = "368f119e-22c1-4124-8efa-c6cfffa06002"
Set Organization = diadoc.GetOrganizationById(Boxid)
Dim inn_s, kpp_s, CounteragentList, s, s_id, IndexKey
'Ïîëó÷àåì ñïèñîê êîíòðàãåíòîâ ñ çàäàííûìè ÈÍÍ/ÊÏÏ
Set CounteragentList = diadoc.GetCounteragents(token, Boxid, Null, Null)
For s = 0 To CounteragentList.TotalCount
s_id = CounteragentList.TotalCount
IndexKey = CounteragentsList.CounteragentsList.Item(s).IndexKey
Worksheets("Sheet3").Cells(i, 1).Value = s_id
Worksheets("Sheet3").Cells(i, 2).Value = IndexKey
s = s + 1
Next s
Worksheets("Sheet3").Activate
End Sub
Ошибка:
Ошибка:
Run-time error '424':
Object required
from diadocapi-docs.
в GetDocuments вы вместо boxId передаете orgId, это разные идентификаторы
boxId должен быть видимо bdc1e5e9-b096-4c8d-bc02-958b2d9ec379
from diadocapi-docs.
А в GetCounteragents как раз нужно orgId, тут все правильно
Ошибка может быть из-за того, что переменная s вышла за границы массива CounteragentsList. TotalCount - это общее число контрагентов, а GetCounteragents по-умолчанию возвращает максимум 100
from diadocapi-docs.
Related Issues (20)
- Проверка остатка документов в пакете HOT 1
- Ограничение на частоту отправки запросов
- Авторизация по сертификату в Perl HOT 2
- Должность в контексте подписания УПД. Метод ExtendedSignerDetails не возвращает должность (jobtitle), в профиле сотрудника данные заполнены.
- Ограничения на частоту обращений к API (RPS)
- Фильтр для GetDocflowEvents (версия 3) HOT 2
- Метод GetCounteragent, параметр CurrentStatus в случае роуминга
- Сохранение входящих документов для хранение в архиве
- Получение списка только заблокированных сотрудников.
- Генерация титула покупателя с МЧД HOT 1
- Подтверждение аннулирования HOT 2
- Использование согласующей подписи при использовании метода DssSign
- Невозможно получить данные о роуминговых операторах для произвольной организации через API
- Титул покупателя с МЧД на УКД
- Генерация УПД формата приказа ФНС № 970. HOT 1
- Возвращаемое значение метода "GetDocumentTypes". 1С HOT 1
- Подскажите пожалуйста по API
- Метод SignatureRejectionGenerationRequestV2 возвращет ошибку. Непонятно в чем именно проблема
- Подписание документа, при помощи флеш-ключа, через API
- Код ошибки: 409 Setting is required for document exchange. Apply for roaming on www.diadoc.ru/roaming
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diadocapi-docs.