# FindProfileDocumentFilesRequest

Запрос на получение заявления о присоединении к [Договору](https://moneta.ru/info/d/ru/public/merchants/b2boffer.pdf)

Для отправки запроса FindProfileDocumentsRequest необходимо получить id документа. Получить id документа можно запросом FindProfileDocumentsRequest&#x20;

```java
Запрос:
{  
   "Envelope":{  
      "Header":{  
         "Security":{  
            "UsernameToken":{  
               "Username":"Username",
               "Password":"Password"
            }
         }
      },
      "Body":{  
         "FindProfileDocumentsRequest":{  
            "unitId":11111
         }
      }
   }
}
Ответ:
{  
   "Envelope":{  
      "Body":{  
         "FindProfileDocumentsResponse":{  
            "document":[  
               {  
                  "id":1111,
                  "attribute":[  
                     {  
                        "approved":false,
                        "value":"test",
                        "key":"comments"
                     },
                     {  
                        "approved":true,
                        "value":"2019-08-20T10:39:27.000+03:00",
                        "key":"modificationdate"
                     }
                  ],
                  "type":"OTHER",
                  "hasAttachedFiles":false
               }
            ]
         }
      }
   }
}
```

```java
Запрос:
{
  "Envelope": {
    "Header": {
      "Security": {
        "UsernameToken": {
          "Username": "USERNAME",
          "Password": "PASSWORD"
        }
      }
    },
    "Body": {
      "FindProfileDocumentFilesRequest": {
        "documentId": 1111
      }
    }
  }
}

Ответ:

{
  "Envelope": {
    "Body": {
      "FindProfileDocumentFilesResponse": {
        "file": [
          {
            "approved": true,
            "documentId": 1111,
            "mimeType": "image\/jpeg",
            "requestUri": "\/info\/private\/documents\/364640433885312461716.jpg",
            "title": "Scan.jpg",
            "fileId": 10001
          }
        ]
      }
    }
  }
}
```

{% hint style="info" %}
В FindProfileDocumentFilesResponse будет содержаться ссылка на документ.\
Необходимо преобразовать ссылку, добавив <https://moneta.ru> и получить ссылку типа: <https://moneta.ru/info/private/documents/364640433885312461716.jpg>
{% endhint %}

```markup
Запрос:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1">
            <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                    wsu:Id="XWSSGID-1560771336320-2024615317"
                    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                <wsse:Username>USERNAME</wsse:Username>
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns2:FindProfileDocumentFilesRequest xmlns:ns2="http://www.moneta.ru/schemas/messages.xsd" xmlns="">
            <ns2:documentId>9996</ns2:documentId>
        </ns2:FindProfileDocumentFilesRequest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Ответ:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <ns2:FindProfileDocumentFilesResponse xmlns:ns2="http://www.moneta.ru/schemas/messages.xsd">
            <ns2:file>
                <ns2:documentId>9996</ns2:documentId>
                <ns2:blob>
                    <xop:Include href="cid:023786ad-d52b-4d0e-b763-fc8c4c2f5756%40www.moneta.ru"
                                 xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
                </ns2:blob>
                <ns2:approved>true</ns2:approved>
                <ns2:fileId>10001</ns2:fileId>
                <ns2:mimeType>image/jpeg</ns2:mimeType>
                <ns2:title>Scan.jpg</ns2:title>
            </ns2:file>
        </ns2:FindProfileDocumentFilesResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


```

{% hint style="info" %}
При запросе FindProfileDocumentFilesRequest необходимо включить механизм MTOM - <https://en.wikipedia.org/wiki/Message_Transmission_Optimization_Mechanism> &#x20;
{% endhint %}

{% hint style="info" %}
FindProfileDocumentFilesResponse будет содержать файл. Файл будет лежать после XML, а внутри XML будет ссылка на файл.&#x20;
{% endhint %}

Все запросы маркетплейс отправляет с помощью интерфейса MONETA.MerchantAPI.

{% hint style="info" %}
Интерфейс [MONETA.MerchantAPI](http://www.moneta.ru/doc/MONETA.MerchantAPI.v2.ru.pdf) представляет собой Web-сервис, описанный по спецификации Web Services Description Language [(WSDL)](https://service.moneta.ru/services.wsdl), использующий протокол Simple Object Access Protocol (SOAP) для передачи информации.
{% endhint %}
