# Welcome to MyDataCoin

Join the personal data revolution with MyDataCoin!

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

## About

MyDataCoin is a blockchain-based platform that aims to create a more transparent, ethical, and equitable model for personal data exchange. MyDataCoin also offers data buyers a more streamlined and cost-effective process for acquiring high-quality data while ensuring the privacy and consent of the data providers.

## Overview

{% content-ref url="/pages/sZC89OgTptEvgWi3Gemb" %}
[MDC Token Distribution and Supply](/overview/mdc-token-distribution-and-supply)
{% endcontent-ref %}

{% content-ref url="/pages/uJq66a0teiCfJIgD1XTu" %}
[Tech Stack](/overview/tech-stack)
{% endcontent-ref %}

{% content-ref url="/pages/pxFUbuv1tEQPWLCLbHrq" %}
[How to contribute](/overview/how-to-contribute)
{% endcontent-ref %}

## Product Guides

We have compiled some helpful guides to help you set up our product quickly and easily.

{% content-ref url="/pages/fuLLIi5x3ZgnIxyuv9SI" %}
[Become a Data Provider](/product-guides/become-a-data-provider)
{% endcontent-ref %}

{% content-ref url="/pages/H9WyDu30mE94iCWZOW8f" %}
[Become a Validator](/product-guides/become-a-validator)
{% endcontent-ref %}

### Use Cases

{% content-ref url="/pages/FjHCIVdgl80aHSQGvYZr" %}
[Downloads](/helpful-materials/downloads)
{% endcontent-ref %}


# MDC Token Distribution and Supply

MDC is the native currency of the MyDataCoin blockchain, and it is necessary to participate in block production and receive rewards for users who share their data. MDC is an inflationary currency with no maximum supply cap.

| Name         | MyDataCoin    |
| ------------ | ------------- |
| Symbol       | MDC           |
| Total Supply | 1,000,000,000 |
| Max Supply   | N/A           |
| Mintable     | TRUE          |
| Burnable     | TRUE          |

<figure><img src="https://lh4.googleusercontent.com/TsPVyxaQ4vbQ27I0Y_CEWsAHhCVezgg77u3KA437SjelFJTCemQcqopTKMHvPV2QyB9fTbNx6n9p6Zfo_78Rgf0xYLMU48RRFqLV_lrOKAWDuaYkvZgy-y5SI1y8VqwcA55dZGAm3Eb0oNQKlEBB4oRSZaBeMa8SXzIz-0M-UUZzZJ_6EEGU_3YTrxORF0I" alt=""><figcaption></figcaption></figure>

The initial distribution of MDC is 1 billion tokens, which includes all categories of token recipients in the distribution schedule, except for data producers who receive rewards in the form of dividends for sharing their personal data. As the number of users and data categories increases, there will be an inflationary increase that is crucial for the system during the initial stages of network development.

<figure><img src="https://lh4.googleusercontent.com/dFExctd7AEa4ZSLo_GhYooHzAOcT6M5XstgiUzkblJ0Mg7D7wjkVLPzFvMir_eh0BWkS-4qG9tsJECj_1dVvF4cKmFyjU2B2oORTivVUh6GqQ33GJmEmDexh7uuJyK8XiV55DRGJPHp-9O8mOrNh43wJVQk5fXjIGFek4CXelhnbz1ezZrnEPnzZbCvhP1Y" alt=""><figcaption></figcaption></figure>

#### Inflation

Inflation serves as a stimulus, providing network members with an incentive to participate. Therefore, it was decided to offer high annual rates, such as 20%, to create a healthy network and promote decentralization. There are two primary reasons to stake or delegate MDC:

&#x20;

**Short-term financial gain**

By staking or participating in inflation, holders receive a reward that is proportional to the amount staked or held. This reward may include a block reward or transaction fee proportional to your participation. Conversely, by holding a PoS asset in cold storage or otherwise neglecting participation, the asset could depreciate at a rate of 5% to 20% per year.

\
**Long-term financial gain**

For PoS systems, staking is how the system secures the network. This will reduce the set of possible attackers and help keep the network secure. Systems with inflation use this mechanism to redistribute lost assets. Participation in inflation helps to ensure that assets retain value in the long run.

<br>


# Tech Stack

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

* [Protocol Architecture](#protocol-architecture)
* [Self-Sovereign Identity](#self-sovereign-identity)

## Overview

MyDataCoin is in the process of developing a public blockchain that utilizes the **Cosmos SDK** and **Tendermint Core** technologies. The Cosmos SDK provides a framework for building customizable, modular blockchains that can interoperate with one another. It also includes tools for developing decentralized applications (dApps) and smart contracts. Tendermint Core is a consensus engine that uses the Tendermint BFT (Byzantine Fault Tolerance) algorithm to ensure secure and fast transaction processing on the blockchain. By utilizing these technologies, MyDataCoin aims to create a scalable and interoperable blockchain platform that can be used for a variety of decentralized applications, including data sharing and privacy-preserving technologies.

<figure><img src="https://lh6.googleusercontent.com/rljPDPsCtDL6qYOcKp0xZaALBjHr0ALGI5DB7P17F7zIIk1LFhC8GePCu986fYr5RvpkyPUlk5NNiVjpHcbUdljLS8VY515IDYqrj8Pth5RcE7Cj5TXWX9yg69NiFrKaNwjMqEDehqQCjHvss2fzDIc3PBWph3J2sw2QbHNoo4P0sWbw5ZFBG22dLoOhaG8" alt=""><figcaption><p>MDC Tech Stack</p></figcaption></figure>

The Tendermint Core is a high-performance, consistent, flexible, and secure **consensus** module with strict fork accountability. It relies on [Proof-of-Stake (PoS)](https://eprint.iacr.org/2019/1460.pdf) with delegation and  [Practical Byzantine Fault Tolerance](https://github.com/tendermint/tendermint). This advantage provides us a possibility to develop a high-performance, consistent and secure decentralized network.

The Tendermint BFT provides security guarantees, including:

1. **Forks** are never created, provided that half or more validators are honest.
2. **Strict accountability** for fork creation allows determining liability.
3. Transactions are **finalized** as soon as a block is created.<br>

The Cosmos SDK provides a rich set of modules that address common concerns such as governance, tokens, other standards, and interactions with other blockchains through the Inter-Blockchain Communication Protocol (IBC). Some production-grade modules such as Auth, Bank, Distribution, Mint, etc, are going to be used in MDC.

The signing of a smart agreement between the participants of the system should be carried out using CosmWasm. CosmWasm is a new smart contract platform created for the Cosmos ecosystem.

### Protocol Architecture

To elaborate further, the MyDataCoin network will serve as the foundation for a protocol that enables secure and decentralized connectivity between data owners and data holders. This protocol will utilize a decentralized linking mechanism that allows data owners to connect with multiple data holders in a secure and transparent manner.

The MyDataCoin Bridge implementation will serve as the link between the main network and the data holders, ensuring that data is transmitted securely and efficiently. The MyDataCoin Mapper solution will be used to combine multiple accounts from different data holders into one, providing a unified view of the data.

The goal of this protocol is to provide a decentralized and transparent data sharing mechanism that empowers individuals to control their personal data and securely share it with trusted parties. By leveraging the MyDataCoin network and associated technologies, this protocol aims to improve data privacy and security while enabling more efficient and effective data sharing.

<figure><img src="https://lh7-us.googleusercontent.com/_XtFRRZKe2Tm9sXNFklDnvnleWNafTPR3qulN1evT_lRo9NaQqH_cq10PmFatrqoG9ocqCvLfBS02UoWe6OaVNLkD1W1rXwsoNVIMXMnlBFvaeBO4yxpFn0UmOdUVgYnz6NyTxzwuirzWoHt484N83o" alt=""><figcaption><p>Basic Schema</p></figcaption></figure>

### Self-Sovereign Identity

Self-Sovereign Identity (SSI) is a new approach to digital identity that puts individuals in control of their own identity data. It is built on three foundational technologies: blockchain, Decentralized Identifiers (DIDs), and Verifiable Credentials (VCs).

Blockchain provides the decentralized infrastructure for SSI, allowing individuals to securely store and manage their identity data on a distributed ledger. This eliminates the need for centralized identity providers, which can be vulnerable to data breaches and hacks.

Decentralized Identifiers (DIDs) are a type of identifier that is independent of any centralized authority or registry. DIDs are unique, cryptographically secure identifiers that are owned and controlled by the individual they represent. DIDs enable individuals to create and manage their own identity data, and to selectively share that data with others.

Verifiable Credentials (VCs) are digital credentials that contain information about an individual's identity, such as their name, date of birth, and proof of address. VCs are issued by trusted parties, such as governments, educational institutions, or employers, and are cryptographically signed to ensure their authenticity. VCs can be stored and managed by the individual they represent, and can be selectively shared with others as needed.

Together, these three technologies provide the foundation for a new paradigm of digital identity that is secure, decentralized, and empowers individuals to control their own identity data.

<figure><img src="https://lh7-us.googleusercontent.com/ubyQINQUlhtDQEkSQ99UL3rEdhXE3y-40EUK8xbevb_fgkGy3C89SruQW62p2dtor1dKITbc3kYdCts3GYWpfKXewas39D_N8cg8Jw5onmjgn7YdapL68wX0BWDW0dose7LCrH1fMyS05tw73H5G_5M" alt=""><figcaption><p>SSI</p></figcaption></figure>

**Why SSI?**

* A secure and digital peer-to-peer channel is established between ID Issuer, ID Owner and ID Verifier. When credentials are exchanged not even the Self-Sovereign Identity system provider knows what is being exchanged. Credential issuing becomes simpler and faster.
* SSI Credentials are tamper-proof through the use of cryptography.
* They are private and under your control. SSI uses Selective Identity disclosure technology.
* Self-Sovereign Identity credentials can be verified anywhere, at any time. Even if the issuer does not exist anymore (with the exception of situations where the issuance of credentials happened using Private DIDs and the DID of the issuer was not written on the ledger).
* **Personal Data** is not stored on centralized servers. Meaning that for hackers to steal 50 million digital identity records they would have to hack those 50 million people individually. Considerably more difficult.
* Self-Sovereign Identity **tries to abolish multiple passwords**. You just need to know your wallet password.

\
A Decentralized Identifier ([DID](https://www.w3.org/TR/did-core/)) is a unique identifier that is going to be used in the MyDataCoin ecosystem. Data collectors can issue signed credentials using a DID to users, allowing them to share their data with other data consumers. The authenticity of the credentials can be verified by referring to the DID document on the MyDataCoin network. The MyDataCoin-based DID is also used to ensure the reliability and integrity of the shared data. By utilizing DIDs, MyDataCoin aims to establish a self-sovereign identity system that empowers individuals to control their own data and share it with others in a secure and transparent manner.

[Decentralized Identifiers](https://www.w3.org/TR/did-core/#dfn-decentralized-identifiers) are a component of larger systems, such as the Verifiable Credentials ecosystem \[[VC-DATA-MODEL](https://www.w3.org/TR/did-core/#bib-vc-data-model)], which influenced the design goals for this specification. The design goals for Decentralized Identifiers are summarized here.

| Decentralization | Eliminate the requirement for centralized authorities or single point failure in identifier management, including the registration of globally unique identifiers, public verification keys, [services](https://www.w3.org/TR/did-core/#dfn-service), and other information. |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Control          | Give entities, both human and non-human, the power to directly control their digital identifiers without the need to rely on external authorities.                                                                                                                           |
| Privacy          | Enable entities to control the privacy of their information, including minimal, selective, and progressive disclosure of attributes or other data.                                                                                                                           |
| Security         | Enable sufficient security for requesting parties to depend on [DID documents](https://www.w3.org/TR/did-core/#dfn-did-documents) for their required level of assurance.                                                                                                     |
| Proof-based      | Enable [DID controllers](https://www.w3.org/TR/did-core/#dfn-did-controllers) to provide cryptographic proof when interacting with other entities.                                                                                                                           |
| Discoverability  | Make it possible for entities to discover [DIDs](https://www.w3.org/TR/did-core/#dfn-decentralized-identifiers) for other entities, to learn more about or interact with those entities.                                                                                     |
| Interoperability | Use interoperable standards so [DID](https://www.w3.org/TR/did-core/#dfn-decentralized-identifiers) infrastructure can make use of existing tools and software libraries designed for interoperability.                                                                      |
| Portability      | Be system- and network-independent and enable entities to use their digital identifiers with any system that supports [DIDs](https://www.w3.org/TR/did-core/#dfn-decentralized-identifiers) and [DID methods](https://www.w3.org/TR/did-core/#dfn-did-methods).              |
| Simplicity       | Favor a reduced set of simple features to make the technology easier to understand, implement, and deploy.                                                                                                                                                                   |
| Extensibility    | Where possible, enable extensibility provided it does not greatly hinder interoperability, portability, or simplicity.                                                                                                                                                       |


# How to contribute

Help us grow.

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

## By reporting bugs

{% content-ref url="/pages/3EeJ35NhBnFEz4v26aML" %}
[By reporting bugs](/overview/how-to-contribute/by-reporting-bugs)
{% endcontent-ref %}

### By watching paid Ads

{% content-ref url="/pages/Yb9Bu45z5JtQ0c8JdJA5" %}
[By watching paid Ads](/overview/how-to-contribute/by-watching-paid-ads)
{% endcontent-ref %}

## By inviting new members

{% content-ref url="/pages/QTpel3MArMoVROhHz428" %}
[By inviting new members](/overview/how-to-contribute/by-inviting-new-members)
{% endcontent-ref %}


# By reporting bugs

Help us to find bugs and earn DataCrystals

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

Found a bug? Send a screenshot with a description of the error to the Telegram group: [https://t.me/mdc\_community\_group](https://t.me/mdc_community_group?boost) and receive 10 DC. Your contribution is invaluable to us.


# By watching paid Ads

Watch paid Ads and earn DataCrystals

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

To support our development efforts, you can watch paid advertisements in our app. Simply go to the main menu and click on the "Get 5 DC" button. Watch the entire advertisement and you will receive a reward of 5 DC. This is a simple and easy way to support our work while also earning some DC for yourself.


# By inviting new members

Earn DataCrystals by inviting new members

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

Here is a full instruction on how to invite people and earn DataCrystals:

1. Open the MyDataCoin application and navigate to the main menu.
2. Click on the "**Get 10 DC**" button to access your referral code.
3. Copy your referral code to your clipboard.
4. Share your referral code with your friends and acquaintances through social media, messaging apps, email, or any other way you prefer.
5. When someone uses your referral code to sign up for the MyDataCoin application, they will receive a bonus of 10 DataCrystals.
6. Once your referral's account is active and they complete certain tasks, you will receive a reward of 10 DC.
7. You can track your referral rewards in the "Referral" section of the MyDataCoin application.

Remember, you can only earn rewards for a limited number of referrals, so make sure to invite your friends and acquaintances early on to maximize your rewards.

<https://youtube.com/shorts/Z1vjJwhD00A?feature=share>


# Become a Data Provider

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

If you are already monetizing user data or planning to do so, MyDataCoin offers partnership opportunities for you to earn with us. In the following subsections, you will find all the necessary information on how to become our partner and start earning. Please follow the connection instructions carefully. If you have any questions, please feel free to email us at <info@mydatacoin.io>.

{% content-ref url="/pages/4SDLDS2XEeuzP5ct491p" %}
[For Managers](/product-guides/become-a-data-provider/for-managers)
{% endcontent-ref %}

{% content-ref url="/pages/uHzfgb66gxcILTbblKDE" %}
[For Developers](/product-guides/become-a-data-provider/for-developers)
{% endcontent-ref %}


# For Managers

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

**Table of contents:**

* [Registration](#registration)
* [Dataset Upload Process](#dataset-upload-process)

To access our website:

* For the testing environment, use <https://test-app.mydatacoin.io>
* For the production environment, use <https://app.mydatacoin.io>

### Registration

<figure><img src="/files/hLZvv21T6dVGMC5gmmEQ" alt=""><figcaption><p>Marketplace</p></figcaption></figure>

Commencing your journey with MyDataCoin is a swift and effortless process, with registration typically requiring just around 5 minutes of your time. To initiate this, visit our primary page: the Marketplace. Here, you'll encounter the registration interface presenting two options:

* **Data Consumer:** Tailored for individuals or organizations seeking to **acquire** datasets. Explore the comprehensive array of datasets available on the Home page before proceeding.
* **Data Holder:** Designed for individuals or organizations keen on **vending** a dataset. Ensure completion of all requisite information and set up your dataset meticulously.

Furthermore, you'll be prompted to input your First Name, Last Name, and email address. A verification code will be dispatched to your email for confirmation purposes.&#x20;

<figure><img src="/files/SsIo2qzwPeoOEDE8OqQP" alt="" width="563"><figcaption><p>Registration</p></figcaption></figure>

> Upon successful email verification, the subsequent steps diverge based on the role you select.

After opting for the role of a *Data Consumer* and completing the email verification process, Data Consumers should fill in the company information on the settings page.&#x20;

After your status of company changes from "Awaiting" to "Verified", you can navigate to the Home page and explore all uploaded datasets.&#x20;

Save your favorites and make purchases hassle-free!

***

After opting for the role of a *Data Holder* and once your email is confirmed, the journey for Data Holders unfurls, presenting distinct subsequent actions and guidelines:

The system activates a modal window divided into four stages. The first three steps are for entering information about your company.

<figure><img src="/files/2g2IFDlVejY01huvArlH" alt=""><figcaption><p>Data of your company (1)</p></figcaption></figure>

<figure><img src="/files/squWSR0YQRUVGkKc38i2" alt=""><figcaption><p>Data of your company (2)</p></figcaption></figure>

After successful completion of the first two stages, the system will automatically send your company's data for verification.

<figure><img src="/files/oGxUswRIxUwm3Q95pVQs" alt=""><figcaption><p>Data of your company (3)</p></figcaption></figure>

### Dataset Upload Process

Once you’ve completed the information for your company, which includes uploading your company logo, you’ll receive a **secret token** as a first step for uploading your dataset.&#x20;

{% hint style="danger" %}
Do not transfer the token to third parties, and beware of getting the token on the Internet. In case of suspicious actions related to your account, immediately invoke it and request a new token.
{% endhint %}

You need to send this token to your IT specialists to grant access to work with MyDataCoin Bridge. The last step is to obtain the **URL** from the IT specialist and enter it in the designated field alongside the secret token (you can also reach it on your settings page later).

<figure><img src="/files/CHwnc2coQ6uZLgML0kUU" alt=""><figcaption><p>Secret token and Service URL</p></figcaption></figure>

After successful completion of all stages, you will see all the data you have filled in on the **Dashboard** page and your dataset uploaded in the Manage Dataset page.

<figure><img src="/files/ekYkMG8PRkr4Eln57lE0" alt=""><figcaption></figcaption></figure>

To enhance your dataset in the page My Datasets, simply click the 'Edit' button and fill in the details. The more comprehensive your data, the more appealing it becomes to potential buyers.

{% hint style="info" %}
It's important to set the price of your dataset. The estimated price set by the system is 8.77 USD.
{% endhint %}

Once you've added all the information, your updated dataset will be readily available.

<figure><img src="/files/xhmDG5XsJ0jCKfg3yzZx" alt=""><figcaption><p>Your Dataset</p></figcaption></figure>

After your status of company changes from "Awaiting" to "Verified", you will get access to the functionality of the system.


# For Developers

In this guide, we provide detailed instructions for connecting a Data Holder to MyDataCoin Bridge and receiving requests.

{% hint style="warning" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

**Table of contents:**

* [Install Docker](#install-docker)
* [Setup Docker](#setup-docker)
* [Subscribe](#subscribe)
* [Unsubscribe](#unsubscribe)
* [Upload a DataSet](#upload-a-dataset)
* [User Model](#user-model)
* [Add Records](#add-records)
* [Update Records](#update-records)

### System Requirements

* **Hardware:**\
  CPU: Intel Core i3 or AMD Ryzen 3.

  RAM: At least 4GB.

  HDD: 20GB free space.\
  64-bit kernel and CPU support for virtualization.
* **Software:**\
  Linux 18.04 LTS or Higher, Windows 10 or Higher\
  Docker for [Linux](https://docs.docker.com/desktop/install/linux-install/) or [Windows](https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe?utm_source=docker\&utm_medium=webreferral\&utm_campaign=dd-smartbutton\&utm_location=module&_gl=1*1h1edy2*_ga*MTY3NDYyODgzOC4xNjg1OTUxODU2*_ga_XJWPQMJYHQ*MTY4NzI1MzU5Ny4zLjEuMTY4NzI1MzcxMC42MC4wLjA.)

### Overview

This guide provides a comprehensive explanation of how to effectively interact with the MyDataCoin ecosystem. To integrate successfully, you will need to set up an endpoint that can receive POST requests, which will, in turn, return the response described in the sections below.

### Install Docker

Please select the appropriate link for your operation system and follow the provided instructions to install Docker:

* For Linux: [Docker Installation Instructions for Linux](https://docs.docker.com/engine/install/)

If you use Ubuntu, and have a following error:

```
E: Package 'docker-ce' has no installation candidate
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io'
E: Couldn't find any package by regex 'containerd.io'
E: Unable to locate package docker-buildx-plugin
E: Unable to locate package docker-compose-plugin
```

please visit: [Link](https://itslinuxfoss.com/fix-package-docker-ce-no-installation-candidate-error/#:~:text=The%20%E2%80%9Cpackage%20docker%20ce%20has%20no%20installation%20candidate%E2%80%9D%20issue%20occurs,key%20and%20then%20the%20repository.).

* For Windows: [Docker Installation Instructions for Windows](https://docs.docker.com/docker-for-windows/install/)&#x20;
* For macOS: [Docker Installation Instructions for macOS](https://docs.docker.com/docker-for-mac/install/)

### Installing Docker Compose

To make sure you obtain the most updated stable version of Docker Compose, you’ll download this software from its [official Github repository](https://github.com/docker/compose).

First, confirm the latest version available in their [releases page](https://github.com/docker/compose/releases). At the time of this writing, the most current stable version is `1.29.2`.

The following command will download the `1.29.2` release and save the executable file at `/usr/local/bin/docker-compose`, which will make this software globally accessible as `docker-compose`:

```bash
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
```

Next, set the correct permissions so that the `docker-compose` command is executable:

```bash
sudo chmod +x /usr/local/bin/docker-compose
```

To verify that the installation was successful, you can run:

```bash
docker-compose --version
```

### Setup Docker

{% hint style="info" %}
Before you begin, make sure that you have an **Secret Token**. You should have received this token after completing the registration process, as described [here](/product-guides/become-a-data-provider/for-managers#registration).
{% endhint %}

After Docker successfully installed, you need to download **docker-compose.yml** from our official repository:

```git
git clone https://github.com/MyDataCoin/mdc-docker
```

1. Open **docker-compose.yml** file to make changes;
2. Get your **Secret Token** from <https://app.mydatacoin.io/settings>. You will find it in **Settings** tab;
3. Put the token in AUTH\_TOKEN env variable.

<figure><img src="/files/IbEGeUt8rbggWXBevtAo" alt=""><figcaption><p>Change Secret Token</p></figcaption></figure>

After you made changes, save the file and run the following command in terminal:

```
docker-compose up -d
```

> Be sure, that port 8000 is open and ready for inbound connections. To change the settings, run the command: sudo ufw allow 8000/tcp

### Upload a DataSet

{% hint style="danger" %}
Please ensure that you create a DataProvider entity in the Marketplace before uploading any datasets. To proceed, please provide your company information [here](https://app.mydatacoin.io/settings).
{% endhint %}

{% hint style="info" %}
Important! The data you upload will not be transferred to us or any third parties; it will be stored in your Docker container.
{% endhint %}

To prepare the data monetization process, you need to prepare a JSON file with data in the format [User Model](#user-model) shown below.

After docker successfully started, you need to open browser and input the following url: <http://your\\_server\\_address:8000/upload>, then you'll see following page:

<figure><img src="/files/HpGPtL1AdYcSL9NERAzT" alt=""><figcaption><p>Upload json file</p></figcaption></figure>

Put your Secret Token in the **Secret Token** field and give your dataset a name, choose a dataset you've prepared and press Upload.&#x20;

Now you ready to go! Please feel free to ask any questions about integration process. Send us email to <as@mydatacoin.io>

### User model sample

<details>

<summary>Json User Model</summary>

{% code title="user.json" lineNumbers="true" fullWidth="true" %}

```json5
[
  {
     "profile":{
        "recordId": "1" or "dd3cc469-096f-4b9e-a8fb-ce5ef32c5642",
        "firstName":"John",
        "lastName":"Doe",
        "dateOfBirth":"1999-09-09T00:00:00Z",
        "gender":null,
        "email":"sagynbaev6@mail.com",
        "phone":"+7(777)222-33-44",
        "maritalStatus":0,
        "income":0
     },
     "basicData":{
        "interests":null,
        "languages":null,
        "religionViews":null,
        "politicalViews":null
     },
     "contacts":{
        "mobilePhone":null,
        "address":null,
        "linkedAccounts":null,
        "website":null
     },
     "workAndEducation":{
        "placeOfWork":null,
        "skills":null,
        "university":null,
        "faculty":null
     },
     "placeOfResidence":{
        "currentCity":null,
        "birthPlace":null,
        "otherCities":null
     },
     "personalInterests":{
        "briefDescription":null,
        "hobby":null,
        "sport":null
     },
     "deviceInformation":{
        "operatingSystem":null,
        "displayResolution":null,
        "browser":null,
        "iSP":null,
        "adBlock":false
     },
     "cookies":{
        "sessionState":null,
        "language":null,
        "region":null,
        "recentPages":null,
        "shoppingCart":[
           {
              "productId":null,
              "productName":"maxsimus1",
              "productPrice":null,
              "quantity":null,
              "subTotal":null,
              "total":null,
              "couponCode":null,
              "shippingInformation":null,
              "taxInformation":null
           },
           {
              "productId":null,
              "productName":"maxsimus",
              "productPrice":6565,
              "quantity":null,
              "subTotal":null,
              "total":null,
              "couponCode":null,
              "shippingInformation":null,
              "taxInformation":null
           }
        ]
     }
  },
  {
     "profile":{
        "firstName":"Jason",
        "lastName":"Cropp",
        "dateOfBirth":"2002-11-09T00:00:00Z",
        "gender":null,
        "email":[
           "amaymon02@mail.ru"
        ],
        "phone":[
           "+77443332424",
           "+996222334455"
        ],
        "maritalStatus":0,
        "income":0
     },
     "basicData":{
        "interests":null,
        "languages":null,
        "religionViews":null,
        "politicalViews":null
     },
     "contacts":{
        "mobilePhone":"IPHONE13",
        "address":null,
        "linkedAccounts":null,
        "website":null
     },
     "workAndEducation":{
        "placeOfWork":null,
        "skills":null,
        "university":"KNU",
        "faculty":null
     },
     "placeOfResidence":{
        "currentCity":null,
        "birthPlace":"bishkek",
        "otherCities":null
     },
     "personalInterests":{
        "briefDescription":null,
        "hobby":[
           "biohacking"
        ],
        "sport":[
           "boxing"
        ]
     },
     "deviceInformation":{
        "operatingSystem":null,
        "displayResolution":null,
        "browser":null,
        "iSP":null,
        "adBlock":true
     },
     "cookies":{
        "sessionState":null,
        "language":null,
        "region":"chui area",
        "recentPages":null,
     },
     "shoppingCart":[
        {
           "productId":1,
           "productName":"pen",
           "productPrice":12,
           "quantity":2,
           "subTotal":24,
           "total":null,
           "couponCode":null,
           "shippingInformation":null,
           "taxInformation":null
        },
        {
           "productId":2,
           "productName":"cup",
           "productPrice":30,
           "quantity":1,
           "subTotal":null,
           "total":null,
           "couponCode":null,
           "shippingInformation":null,
           "taxInformation":null
        }
     ]
  }
]
```

{% endcode %}

</details>

Model details:

<table><thead><tr><th>Parameter</th><th>Data Type</th><th data-type="checkbox">Nullable</th></tr></thead><tbody><tr><td>Profile</td><td><a href="#profile">Profile</a></td><td>true</td></tr><tr><td>BasicData</td><td><a href="#basicdata">BasicData</a></td><td>true</td></tr><tr><td>Contacts</td><td><a href="#contacts">Contacts</a></td><td>true</td></tr><tr><td>WorkAndEducation</td><td><a href="#workandeducation">WorkAndEducation</a></td><td>true</td></tr><tr><td>PlaceOfResidence</td><td><a href="#placeofresidence">PlaceOfResidence</a></td><td>true</td></tr><tr><td>PersonalInterests</td><td><a href="#personalinterests">PersonalInterests</a></td><td>true</td></tr><tr><td>DeviceInformation</td><td><a href="#deviceinformation">DeviceInformation</a></td><td>true</td></tr><tr><td>Cookies</td><td><a href="#cookies">Cookies</a></td><td>true</td></tr></tbody></table>

#### Profile

<table><thead><tr><th>Parameter</th><th>Data Type</th><th>Comment</th><th data-type="checkbox">Nullable</th></tr></thead><tbody><tr><td>recordId</td><td>string</td><td>Unique identifier of record, you can use your database identifier</td><td>false</td></tr><tr><td>firstName</td><td>string</td><td></td><td>true</td></tr><tr><td>lastName</td><td>string</td><td></td><td>true</td></tr><tr><td>dateOfBirth</td><td>DateTime</td><td>Format(1999-09-09T00:00:00Z)</td><td>false</td></tr><tr><td>gender</td><td>int</td><td><p>Enum</p><pre class="language-csharp"><code class="lang-csharp">0 = Male,
1 = Female
</code></pre></td><td>false</td></tr><tr><td>email</td><td>string</td><td></td><td>false</td></tr><tr><td>phone</td><td>string</td><td></td><td>true</td></tr><tr><td>maritalStatus</td><td>int</td><td><p><a href="#maritalstatus">MaritalStatus</a></p><pre class="language-json"><code class="lang-json"><strong>0 = Single,
</strong>1 = Married,
2 = Divorced,
3 = Bachelor,
4 = Widow,
5 = Cohabiting,
6 = Separated,
7 = Living_Separately,
8 = Remarried
</code></pre></td><td>true</td></tr><tr><td>income</td><td>decimal</td><td>Income refers to the amount of money a user earns within a certain period of time.</td><td>true</td></tr></tbody></table>

#### BasicData

<table><thead><tr><th>Parameter</th><th>Data Type</th><th data-type="checkbox">Nullable</th></tr></thead><tbody><tr><td>interests</td><td>string[]</td><td>true</td></tr><tr><td>languages</td><td>string[]</td><td>true</td></tr><tr><td>religionViews</td><td>string[]</td><td>true</td></tr><tr><td>politicalViews</td><td>string[]</td><td>true</td></tr></tbody></table>

#### Contacts

<table><thead><tr><th>Parameter</th><th>Data Type</th><th data-type="checkbox"></th></tr></thead><tbody><tr><td>mobilePhone</td><td>string</td><td>true</td></tr><tr><td>address</td><td>string</td><td>true</td></tr><tr><td>linkedAccounts</td><td>string[]</td><td>true</td></tr><tr><td>website</td><td>string</td><td>true</td></tr></tbody></table>

#### WorkAndEducation

<table><thead><tr><th>Parameter</th><th>Data Type</th><th data-type="checkbox">Nullable</th></tr></thead><tbody><tr><td>placeOfWork</td><td>string</td><td>true</td></tr><tr><td>skills</td><td>string[]</td><td>true</td></tr><tr><td>university</td><td>string</td><td>true</td></tr><tr><td>faculty</td><td>string</td><td>true</td></tr></tbody></table>

#### PlaceOfResidence

<table><thead><tr><th>Parameter</th><th>Data Type</th><th data-type="checkbox">Nullable</th></tr></thead><tbody><tr><td>currentCity</td><td>string</td><td>true</td></tr><tr><td>birthPlace</td><td>string</td><td>true</td></tr><tr><td>otherCities</td><td>string[]</td><td>true</td></tr></tbody></table>

#### PersonalInterests

<table><thead><tr><th>Parameter</th><th>Data Type</th><th data-type="checkbox">Nullable</th></tr></thead><tbody><tr><td>breifDescription</td><td>string</td><td>true</td></tr><tr><td>hobby</td><td>string[]</td><td>true</td></tr><tr><td>sport</td><td>string[]</td><td>true</td></tr></tbody></table>

#### DeviceInformation

<table><thead><tr><th>Parameter</th><th width="169">Data Type</th><th>Comments</th><th data-type="checkbox">Nullable</th></tr></thead><tbody><tr><td>deviceName</td><td>string</td><td>Device used to access the internet</td><td>false</td></tr><tr><td>deviceId</td><td>string</td><td>DeviceId is a parameter that refers to a unique identifier for a device.</td><td>true</td></tr><tr><td>operatingSystem</td><td>string</td><td>Operating system and its version</td><td>false</td></tr><tr><td>displayResolution</td><td>string</td><td>Screen resolution</td><td>true</td></tr><tr><td>browser</td><td>string</td><td>Used browser and its version</td><td>false</td></tr><tr><td>iSP</td><td>string</td><td>Information about the internet service provider and type of connection</td><td>true</td></tr><tr><td>adBlock</td><td>bool</td><td>Presence of ad blockers</td><td>true</td></tr></tbody></table>

#### Cookies

<table><thead><tr><th>Parameter</th><th>Data Type</th><th>Comment</th><th data-type="checkbox">Nullable</th></tr></thead><tbody><tr><td>id</td><td>string</td><td>User identifier</td><td>true</td></tr><tr><td>sessionState</td><td>string</td><td>Session state</td><td>true</td></tr><tr><td>language</td><td>string</td><td>Language settings</td><td>true</td></tr><tr><td>region</td><td>string</td><td>Preferred region settings</td><td>true</td></tr><tr><td>recentPages</td><td>string[]</td><td>Recently visited pages</td><td>true</td></tr><tr><td>shoppingCart</td><td><a href="#shoppingcart">ShoppingCart[]</a></td><td>Shopping cart items</td><td>true</td></tr></tbody></table>

#### ShoppingCart

<table><thead><tr><th>Parameter</th><th>Data Type</th><th>Comments</th><th data-type="checkbox"></th></tr></thead><tbody><tr><td>productId</td><td>string</td><td>unique identifier of the product in the shopping cart</td><td>true</td></tr><tr><td>productName</td><td>string</td><td>name of the product in the shopping cart</td><td>false</td></tr><tr><td>productPrice</td><td>string</td><td>price of the product in the shopping cart</td><td>false</td></tr><tr><td>quantity</td><td>string</td><td>the number of units of a product in the shopping cart</td><td>false</td></tr><tr><td>subTotal</td><td>string</td><td>the total cost of a particular product in the shopping cart (quantity x price)</td><td>true</td></tr><tr><td>total</td><td>string</td><td>the total cost of all products in the shopping cart</td><td>false</td></tr><tr><td>couponCode</td><td>string</td><td>any applied discounts or coupons to the shopping cart</td><td>true</td></tr><tr><td>shippingInformation</td><td>string</td><td>shipping method and cost for the items in the shopping cart</td><td>true</td></tr><tr><td>taxInformation</td><td>string</td><td>applicable taxes for the items in the shopping cart</td><td>true</td></tr></tbody></table>

#### MaritalStatus

Marital status is a characteristic that reflects a person's marital status. Depending on the country and culture, there are different categories of marital statuses. Some of them may include:

| Value              |                                                                                                                   |
| ------------------ | ----------------------------------------------------------------------------------------------------------------- |
| Single             | Single - a person who is not married and does not have an official partner.                                       |
| Married            | Married - a person who is in an official marriage.                                                                |
| Divorced           | Divorced - a person who was in an official marriage but got divorced.                                             |
| Bachelor           | Bachelor/Spinster - a person who lives alone, regardless of their marital status.                                 |
| Widow              | Widower/Widow - a person who lost their spouse.                                                                   |
| Cohabiting         | Cohabiting - two people who live together but are not in an official marriage.                                    |
| Separated          | Separated - a person who was in an official marriage but is in the process of getting divorced.                   |
| Living\_Separately | Living separately - a person who lives separately from their family, for example, in a dormitory or student room. |
| Remarried          | Remarried - spouses who have already been in an official marriage and have remarried.                             |

### Add Records

These two methods serve to update and add users, add user `api/v1/insert` serves so that you do not have to form json every time and fill it with the `/upload` method, instead you can simply write a function that will be executed when you add a new user to the database, that is, you simply add to yours and simultaneously make a request to our database data, in the future this will free you from the constant updating of data.

## Inserts new user profile&#x20;

<mark style="color:green;">`POST`</mark> `https://your-ip-address:your-port/api/v1/insert`

All the body parameters described in [User Model](#user-model-sample)

#### Headers

| Name                                            | Type   | Description                                                                   |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | there should be an authorization token that was entered in docker-compose.yml |

#### Request Body

| Name                                      | Type              | Description                                                            |
| ----------------------------------------- | ----------------- | ---------------------------------------------------------------------- |
| profile<mark style="color:red;">\*</mark> | profile           | [This object and it\`s fields are described above](#profile)           |
| basicData                                 | basicData         | [This object and it\`s fields are described above ](#basicdata)        |
| сontacts                                  | contacts          | [This object and it\`s fields are described above](#contacts)          |
| workAndEducation                          | workdAndEducation | [This object and it\`s fields are described above](#workandeducation)  |
| deviceInformation                         | deviceInformation | [This object and it\`s fields are described above](#deviceinformation) |
| personalInterests                         | personalInterests | [This object and it\`s fields are described above](#personalinterests) |
| placeOfResidence                          | placeOfResidence  | [This object and it\`s fields are described above](#placeofresidence)  |
| cookies                                   | cookies           | [This object and it\`s fields are described above](#cookies)           |

{% tabs %}
{% tab title="200: OK Simple string response" %}

```
{
    "success": "profile add successfully"
}
```

{% endtab %}

{% tab title="400: Bad Request this error is only thrown when the user already exists" %}

<pre><code># error occurs only when recordId already exists in the database

{
<strong>    "error": "this user in already have in database"
</strong>}
</code></pre>

{% endtab %}

{% tab title="401: Unauthorized if you have the wrong authorization token which is in your docker-compose.yml" %}

```
# Check if the provided token in the 'Authorization' header does not match the expected 'auth_token'.
# If it doesn't match, return an error response indicating "Invalid token".
# The status code is set to 401 (Unauthorized).

{
    'error': 'Invalid token',
     'details': "The token provided in the 'Authorization' header is invalid"
}
```

{% endtab %}

{% tab title="415: Unsupported Media Type if you don't have application/json in your headers" %}

```
# Check if the 'Content-Type' header of the request is not set to 'application/json'.
# If it's not set correctly, return an error response indicating "Unsupported Media Type".
# The status code is set to 415 (Unsupported Media Type).

{
    'error': 'Unsupported Media Type', 
    'details': "The 'Content-Type' header must be set to 'application/json'"
}
```

{% endtab %}

{% tab title="500: Internal Server Error if an error occurred while loading data into the postgres database" %}
`"An error occurred while processing the data: {}"  and error in brackets`
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="cURL" %}

```
curl -X PUT "http://your-server-ip:8000/api/v1/insert" \
     -H "Authorization: your_auth_token_here" \
     -H "Content-Type: application/json" \
     -d '{
    "profile": {
        "recordId": "54",
        "firstName": "Alex",
        "lastName": "Vishnevski",
        "dateOfBirth": "2002-11-09T00:00:00Z",
        "gender": 1,
        "email": ["amaymon02@mai8.ru"],
        "phone": ["+996222116992", "+996555848652"],
        "maritalStatus": 0,
        "income": 0
    },
    "basicData": {
        "interests": ["hobbyhorsing","boxing"],
        "languages": ["english", "indian"],
        "religionViews": ["Atheist","Agnostik"],
        "politicalViews": ["liberal"]
    },
    "contacts": {
        "mobilePhone": "IPHONE13",
        "address": "avenue 13",
        "linkedAccounts": ["https://www.tiktok.com/@angiejoliefan?is_from_webapp=1&sender_device=pc"],
        "website": "http://flibusta.site/b/668844/read"
    },
    "workAndEducation": {
        "placeOfWork": "MydataCoin",
        "skills": ["Attractive"],
        "university": "KNU",
        "faculty": "ФИиИт"
    },
    "placeOfResidence": {
        "currentCity": "New-York",
        "birthPlace": "bishkek",
        "otherCities": ["Astana","Peru","Amsterdam"]
    },
    "personalInterests": {
        "briefDescription": "Smart",
        "hobby": ["biohacking"],
        "sport": ["boxing"]
    },
    "deviceInformation": {
        "deviceName": "Mac m2 pro",
        "deviceId": "21313-asdasd-12313",
        "operatingSystem": "windows",
        "displayResolution": "999X999",
        "browser": "internet explorer",
        "iSP": "megaCom provider",
        "adBlock": true
    },
    "cookies": {
        "sessionState": "Active",
        "language": "Russia",
        "region": "chui area",
        "recentPages": ["https://ru.wikipedia.org/wiki%D0%A5%D0%BE%D0%B1%D0%B1%D0%B8%D1%85%D0%BE%D1%80%D1%81%D0%B8%D0%BD%D0%B3"],
        "shoppingCart": [
            {
                "productId": 123,
                "productName": "dragon",
                "productPrice": 100000000,
                "quantity": 1,
                "subTotal": 120000,
                "total": 20,
                "couponCode": "free-dragondotpy",
                "shippingInformation": "st.Avenue 13",
                "taxInformation": "12.23"
            },
            {
                "productId": 1233,
                "productName": "dragon-wife",
                "productPrice": 1,
                "quantity": 1,
                "subTotal": 1,
                "total": 2,
                "couponCode": "free-incubator",
                "shippingInformation": "st.Avenue 13",
                "taxInformation": "0.01"
            }
        ]
    }
}'
```

{% endtab %}

{% tab title="Java" %}

```java
// this endpoint is designed 
// to update the database singly, 
// this solves the problem, let's say that you have new users, and 
// in order not to form and then load json into the database each time, 
// you can simultaneously throw a request to our database at the time of filling 
// your database using api/v1/insert method


// this is an example of an object
// that should be sent to our endpoint, api/v1/insert

// data = {
//     "profile": {
//         "recordId": "54",
//         "firstName": "Alex",
//         "lastName": "Vishnevski",
//         "dateOfBirth": "2002-11-09T00:00:00Z",
//         "gender": 1,
//         "email": ["amaymon02@mai8.ru"],
//         "phone": ["+996222116992", "+996555848652"],
//         "maritalStatus": 0,
//         "income": 0
//     },
//     "basicData": {
//         "interests": ["hobbyhorsing","boxing"],
//         "languages": ["english", "indian"],
//         "religionViews": ["Atheist","Agnostik"],
//         "politicalViews": ["liberal"]
//     },
//     "contacts": {
//         "mobilePhone": "IPHONE13",
//         "address": "avenue 13",
//         "linkedAccounts": ["https://www.tiktok.com/@angiejoliefan?is_from_webapp=1&sender_device=pc"],
//         "website": "http://flibusta.site/b/668844/read"
//     },
//     "workAndEducation": {
//         "placeOfWork": "MydataCoin",
//         "skills": ["Attractive"],
//         "university": "KNU",
//         "faculty": "ФИиИт"
//     },
//     "placeOfResidence": {
//         "currentCity": "New-York",
//         "birthPlace": "bishkek",
//         "otherCities": ["Astana","Peru","Amsterdam"]
//     },
//     "personalInterests": {
//         "briefDescription": "Smart",
//         "hobby": ["biohacking"],
//         "sport": ["boxing"]
//     },
//     "deviceInformation": {
//         "deviceName": "Mac m2 pro",
//         "deviceId": "21313-asdasd-12313",
//         "operatingSystem": "windows",
//         "displayResolution": "999X999",
//         "browser": "internet explorer",
//         "iSP": "megaCom provider",
//         "adBlock": True
//     },
//     "cookies": {
//         "sessionState": "Active",
//         "language": "Russia",
//         "region": "chui area",
//         "recentPages": ["https://ru.wikipedia.org/wiki/%D0%A5%D0%BE%D0%B1%D0%B1%D0%B8%D1%85%D0%BE%D1%80%D1%81%D0%B8%D0%BD%D0%B3"],
//         "shoppingCart": [
//             {
//                 "productId": "123-asda-12312",
//                 "productName": "dragon",
//                 "productPrice": 100000000,
//                 "quantity": 1,
//                 "subTotal": 120000,
//                 "total": 20,
//                 "couponCode": "free-dragondotpy",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "12.23"
//             },
//             {
//                 "productId": "123-qwe-123",
//                 "productName": "dragon-wife",
//                 "productPrice": 1,
//                 "quantity": 1,
//                 "subTotal": 1,
//                 "total": 2,
//                 "couponCode": "free-incubator",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "0.01"
//             }
//         ]
//     }
// }


public class InsertDataExample {
    public static void insert(Object data) {
        HttpClient httpClient = HttpClient.newHttpClient();
        String url = "http://your-server-ip:8000/api/v1/insert";
        
        // here you have to pass your authorization token which you specified 
        // in docker-compose.yml file in environment variables
        
        String authToken = "your_auth_token_here";

        Map<String, String> headers = new HashMap<>();
        headers.put("Authorization", authToken);
        headers.put("Content-Type", "application/json");


        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .headers(headers.entrySet().stream()
                        .map(entry -> entry.getKey() + ":" + entry.getValue())
                        .toArray(String[]::new))
                .POST(HttpRequest.BodyPublishers.ofString(data))
                .build();

        try {
            HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());

            if (response.statusCode() == 200) {
                System.out.println("Data inserted successfully: " + response.body());
            } else {
                System.out.println("Error inserting data: " + response.body());
            }
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
// this endpoint is designed 
// to update the database singly, 
// this solves the problem, let's say that you have new users, and 
// in order not to form and then load json into the database each time, 
// you can simultaneously throw a request to our database at the time of filling 
// your database using api/v1/insert method


// this is an example of an object
// that should be sent to our endpoint, api/v1/insert

// data = {
//     "profile": {
//         "recordId": "54",
//         "firstName": "Alex",
//         "lastName": "Vishnevski",
//         "dateOfBirth": "2002-11-09T00:00:00Z",
//         "gender": 1,
//         "email": ["amaymon02@mai8.ru"],
//         "phone": ["+996222116992", "+996555848652"],
//         "maritalStatus": 0,
//         "income": 0
//     },
//     "basicData": {
//         "interests": ["hobbyhorsing","boxing"],
//         "languages": ["english", "indian"],
//         "religionViews": ["Atheist","Agnostik"],
//         "politicalViews": ["liberal"]
//     },
//     "contacts": {
//         "mobilePhone": "IPHONE13",
//         "address": "avenue 13",
//         "linkedAccounts": ["https://www.tiktok.com/@angiejoliefan?is_from_webapp=1&sender_device=pc"],
//         "website": "http://flibusta.site/b/668844/read"
//     },
//     "workAndEducation": {
//         "placeOfWork": "MydataCoin",
//         "skills": ["Attractive"],
//         "university": "KNU",
//         "faculty": "ФИиИт"
//     },
//     "placeOfResidence": {
//         "currentCity": "New-York",
//         "birthPlace": "bishkek",
//         "otherCities": ["Astana","Peru","Amsterdam"]
//     },
//     "personalInterests": {
//         "briefDescription": "Smart",
//         "hobby": ["biohacking"],
//         "sport": ["boxing"]
//     },
//     "deviceInformation": {
//         "deviceName": "Mac m2 pro",
//         "deviceId": "21313-asdasd-12313",
//         "operatingSystem": "windows",
//         "displayResolution": "999X999",
//         "browser": "internet explorer",
//         "iSP": "megaCom provider",
//         "adBlock": True
//     },
//     "cookies": {
//         "sessionState": "Active",
//         "language": "Russia",
//         "region": "chui area",
//         "recentPages": ["https://ru.wikipedia.org/wiki/%D0%A5%D0%BE%D0%B1%D0%B1%D0%B8%D1%85%D0%BE%D1%80%D1%81%D0%B8%D0%BD%D0%B3"],
//         "shoppingCart": [
//             {
//                 "productId": "123-asda-12312",
//                 "productName": "dragon",
//                 "productPrice": 100000000,
//                 "quantity": 1,
//                 "subTotal": 120000,
//                 "total": 20,
//                 "couponCode": "free-dragondotpy",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "12.23"
//             },
//             {
//                 "productId": "123-qwe-123",
//                 "productName": "dragon-wife",
//                 "productPrice": 1,
//                 "quantity": 1,
//                 "subTotal": 1,
//                 "total": 2,
//                 "couponCode": "free-incubator",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "0.01"
//             }
//         ]
//     }
// }


function insertData(data) {
    const url = 'http://your-server-ip:8000/api/v1/insert';
    
    // here you have to pass your authorization token which you specified 
    // in docker-compose.yml file in environment variables
    const headers = {
        'Authorization': 'your_auth_token_here',
        'Content-Type': 'application/json'
    };

    axios.post(url, data, { headers })
        .then(response => {
            const responseData = response.data;
            if (response.status === 200) {
                console.log('Data inserted successfully:', responseData);
            } else {
                console.log('Error inserting data:', responseData);
            }
        })
        .catch(error => {
            console.error('Request error:', error);
        });
}
```

{% endtab %}

{% tab title="Python" %}

```python
# this endpoint is designed 
# to update the database singly, 
# this solves the problem, let's say that you have new users, and 
# in order not to form and then load json into the database each time, 
# you can simultaneously throw a request to our database at the time of filling 
# your database using api/v1/insert method


# this is an example of an object
# that should be sent to our endpoint, api/v1/insert


# data = {
#     "profile": {
#         "recordId": "54",
#         "firstName": "Alex",
#         "lastName": "Vishnevski",
#         "dateOfBirth": "2002-11-09T00:00:00Z",
#         "gender": 1,
#         "email": ["amaymon02@mai8.ru"],
#         "phone": ["+996222116992", "+996555848652"],
#         "maritalStatus": 0,
#         "income": 0
#     },
#     "basicData": {
#         "interests": ["hobbyhorsing","boxing"],
#         "languages": ["english", "indian"],
#         "religionViews": ["Atheist","Agnostik"],
#         "politicalViews": ["liberal"]
#     },
#     "contacts": {
#         "mobilePhone": "IPHONE13",
#         "address": "avenue 13",
#         "linkedAccounts": ["https://www.tiktok.com/@angiejoliefan?is_from_webapp=1&sender_device=pc"],
#         "website": "http://flibusta.site/b/668844/read"
#     },
#     "workAndEducation": {
#         "placeOfWork": "MydataCoin",
#         "skills": ["Attractive"],
#         "university": "KNU",
#         "faculty": "ФИиИт"
#     },
#     "placeOfResidence": {
#         "currentCity": "New-York",
#         "birthPlace": "bishkek",
#         "otherCities": ["Astana","Peru","Amsterdam"]
#     },
#     "personalInterests": {
#         "briefDescription": "Smart",
#         "hobby": ["biohacking"],
#         "sport": ["boxing"]
#     },
#     "deviceInformation": {
#         "deviceName": "Mac m2 pro",
#         "deviceId": "21313-asdasd-12313",
#         "operatingSystem": "windows",
#         "displayResolution": "999X999",
#         "browser": "internet explorer",
#         "iSP": "megaCom provider",
#         "adBlock": True
#     },
#     "cookies": {
#         "sessionState": "Active",
#         "language": "Russia",
#         "region": "chui area",
#         "recentPages": ["https://ru.wikipedia.org/wiki/%D0%A5%D0%BE%D0%B1%D0%B1%D0%B8%D1%85%D0%BE%D1%80%D1%81%D0%B8%D0%BD%D0%B3"],
#         "shoppingCart": [
#             {
#                 "productId": "123-asda-12312",
#                 "productName": "dragon",
#                 "productPrice": 100000000,
#                 "quantity": 1,
#                 "subTotal": 120000,
#                 "total": 20,
#                 "couponCode": "free-dragondotpy",
#                 "shippingInformation": "st.Avenue 13",
#                 "taxInformation": "12.23"
#             },
#             {
#                 "productId": "123-qwe-123",
#                 "productName": "dragon-wife",
#                 "productPrice": 1,
#                 "quantity": 1,
#                 "subTotal": 1,
#                 "total": 2,
#                 "couponCode": "free-incubator",
#                 "shippingInformation": "st.Avenue 13",
#                 "taxInformation": "0.01"
#             }
#         ]
#     }
# }


def insert_data(data):
    url = 'http://your-server-ip:8000/api/v1/insert'
    
    # here you have to pass your authorization token which you specified 
    # in docker-compose.yml file in environment variables
    headers = {
        'Authorization': 'your_auth_token_here',
        'Content-Type': 'application/json'
    }

    try:
        response = requests.post(url, json=data, headers=headers)
        response_data = response.json()
        
        if response.status_code == 200:
            print("Data inserted successfully:", response_data)
        else:
            print("Error inserting data:", response_data)

    except requests.exceptions.RequestException as e:
        print("Request error:", e)
```

{% endtab %}

{% tab title="C#" %}

```csharp
// this endpoint is designed 
// to update the database singly, 
// this solves the problem, let's say that you have new users, and 
// in order not to form and then load json into the database each time, 
// you can simultaneously throw a request to our database at the time of filling 
// your database using api/v1/insert method


// this is an example of an object
// that should be sent to our endpoint, api/v1/insert

// data = {
//     "profile": {
//         "recordId": "54",
//         "firstName": "Alex",
//         "lastName": "Vishnevski",
//         "dateOfBirth": "2002-11-09T00:00:00Z",
//         "gender": 1,
//         "email": ["amaymon02@mai8.ru"],
//         "phone": ["+996222116992", "+996555848652"],
//         "maritalStatus": 0,
//         "income": 0
//     },
//     "basicData": {
//         "interests": ["hobbyhorsing","boxing"],
//         "languages": ["english", "indian"],
//         "religionViews": ["Atheist","Agnostik"],
//         "politicalViews": ["liberal"]
//     },
//     "contacts": {
//         "mobilePhone": "IPHONE13",
//         "address": "avenue 13",
//         "linkedAccounts": ["https://www.tiktok.com/@angiejoliefan?is_from_webapp=1&sender_device=pc"],
//         "website": "http://flibusta.site/b/668844/read"
//     },
//     "workAndEducation": {
//         "placeOfWork": "MydataCoin",
//         "skills": ["Attractive"],
//         "university": "KNU",
//         "faculty": "ФИиИт"
//     },
//     "placeOfResidence": {
//         "currentCity": "New-York",
//         "birthPlace": "bishkek",
//         "otherCities": ["Astana","Peru","Amsterdam"]
//     },
//     "personalInterests": {
//         "briefDescription": "Smart",
//         "hobby": ["biohacking"],
//         "sport": ["boxing"]
//     },
//     "deviceInformation": {
//         "deviceName": "Mac m2 pro",
//         "deviceId": "21313-asdasd-12313",
//         "operatingSystem": "windows",
//         "displayResolution": "999X999",
//         "browser": "internet explorer",
//         "iSP": "megaCom provider",
//         "adBlock": True
//     },
//     "cookies": {
//         "sessionState": "Active",
//         "language": "Russia",
//         "region": "chui area",
//         "recentPages": ["https://ru.wikipedia.org/wiki/%D0%A5%D0%BE%D0%B1%D0%B1%D0%B8%D1%85%D0%BE%D1%80%D1%81%D0%B8%D0%BD%D0%B3"],
//         "shoppingCart": [
//             {
//                 "productId": "123-asda-12312",
//                 "productName": "dragon",
//                 "productPrice": 100000000,
//                 "quantity": 1,
//                 "subTotal": 120000,
//                 "total": 20,
//                 "couponCode": "free-dragondotpy",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "12.23"
//             },
//             {
//                 "productId": "123-qwe-123",
//                 "productName": "dragon-wife",
//                 "productPrice": 1,
//                 "quantity": 1,
//                 "subTotal": 1,
//                 "total": 2,
//                 "couponCode": "free-incubator",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "0.01"
//             }
//         ]
//     }
// }


namespace InsertDataExample
{
    class Program
    {
        static async Task Main(string[] args)
        {
            string url = "http://your-server-ip:8000/api/v1/insert";
            string authToken = "your_auth_token_here";
            
            # here you have to pass your authorization token which you specified 
            # in docker-compose.yml file in environment variables
            
            HttpClient httpClient = new HttpClient();
            httpClient.DefaultRequestHeaders.Add("Authorization", authToken);
            httpClient.DefaultRequestHeaders.Add("Content-Type", "application/json");

            string requestBody = "{\"profile\": {...}}"; // Replace with your JSON data

            try
            {
                HttpResponseMessage response = await httpClient.PostAsync(url, new StringContent(requestBody, Encoding.UTF8, "application/json"));
                string responseData = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    Console.WriteLine("Data inserted successfully: " + responseData);
                }
                else
                {
                    Console.WriteLine("Error inserting data: " + responseData);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Request error: " + e.Message);
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

### Update Records

The update method serves to synchronize your database with ours, so that the data is always up to date, you just need to write a function that, when updating your user's data, it simultaneously updates the user in our database to keep personal data up to date

## updating an existing user

<mark style="color:orange;">`PUT`</mark> `https://your-ip-address:your-port/api/v1/update?recordId=55`

This method is used to update the data of an existing user, please note that identification occurs by recordId which is located separately outside the data to update

#### Query Parameters

| Name                                       | Type   | Description                                                              |
| ------------------------------------------ | ------ | ------------------------------------------------------------------------ |
| recordId<mark style="color:red;">\*</mark> | String | This string is an identifier by which you will find and update user data |

#### Headers

| Name                                            | Type   | Description                                                                    |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | This token is needed for authorization, which is located in docker-compose.yml |

#### Request Body

<table><thead><tr><th>Name</th><th width="231">Type</th><th>Description</th></tr></thead><tbody><tr><td>deviceInformation</td><td>deviceInformation</td><td><a href="#deviceinformation">this object and it`s fields in the structure are described above</a></td></tr><tr><td>personalInterests</td><td>personalInterests</td><td><a href="#personalinterests">this object and it`s fields in the structure are described above</a></td></tr><tr><td>placeOfresidence</td><td>placeOfResidence</td><td><a href="#placeofresidence">this object and it`s fields in the structure are described above</a></td></tr><tr><td>workAndEducation</td><td>workAndEducation</td><td><a href="#workandeducation">this object and it`s fields in the structure are described above</a></td></tr><tr><td>contacts</td><td>Contacts</td><td><a href="#contacts">this object and it`s fields in the structure are described above</a></td></tr><tr><td>basicData</td><td>BasicData</td><td><a href="#basicdata">this object and it`s fields in the structure are described above</a></td></tr><tr><td>profile</td><td>Profile</td><td><a href="#profile">this object and it`s fields in the structure are described above</a></td></tr><tr><td>cookies</td><td>Cookies</td><td><a href="#cookies">this object and it`s fields in the structure are described above</a></td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK succesfull response" %}

```
# with id profile in brecets
{
    "message":"profile {} successfully updated!"
}
```

{% endtab %}

{% tab title="404: Not Found Not found " %}

```
#with record Id in brecets
{
"error": "Profile with recordId: {} not found." 
}
```

{% endtab %}

{% tab title="500: Internal Server Error Server Error" %}

```
#with details in brecets
{
    "error": "Error updating data.", "details": {}
}
```

{% endtab %}

{% tab title="400: Bad Request Bad request if Record Id invalid" %}

```
# Check if the 'recordId' parameter is missing.
# If it is, return an error response indicating that the record ID must not be null.
# The status code is set to 400 (Bad Request).

{
    'error': "recordID is must be not null", 
    'details': "Please provide a valid 'recordId' parameter."
}
```

{% endtab %}

{% tab title="415: Unsupported Media Type This error occurs when application/json is not specified in headers" %}

```
# Check if the 'Content-Type' header of the request is not set to 'application/json'.
# If it's not set correctly, return an error response indicating "Unsupported Media Type".
# The status code is set to 415 (Unsupported Media Type).

{
    'error': 'Unsupported Media Type', 
    'details': "The 'Content-Type' header must be set to 'application/json'."
}
```

{% endtab %}

{% tab title="401: Unauthorized this happens if you do not have an authorization token in your headers, "Authorization", which is in your docker-compose.yml" %}

```
# Check if the provided token in the 'Authorization' header does not match the expected 'auth_token'.
# If it doesn't match, return an error response indicating "Invalid token".
# The status code is set to 401 (Unauthorized).

{
  'error': 'Invalid token',
  'details': "The token provided in the 'Authorization' header is invalid. Please provide a valid token."
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="cURL" %}

```
curl -X PUT "http://your-server-ip:8000/api/v1/update?recordId=55" \
     -H "Authorization: your_auth_token_here" \
     -H "Content-Type: application/json" \
     -d '{
    "profile": {
        "recordId": "54",
        "firstName": "Alex",
        "lastName": "Vishnevski",
        "dateOfBirth": "2002-11-09T00:00:00Z",
        "gender": 1,
        "email": ["amaymon02@mai8.ru"],
        "phone": ["+996222116992", "+996555848652"],
        "maritalStatus": 0,
        "income": 0
    },
    "basicData": {
        "interests": ["hobbyhorsing","boxing"],
        "languages": ["english", "indian"],
        "religionViews": ["Atheist","Agnostik"],
        "politicalViews": ["liberal"]
    },
    "contacts": {
        "mobilePhone": "IPHONE13",
        "address": "avenue 13",
        "linkedAccounts": ["https://www.tiktok.com/@angiejoliefan?is_from_webapp=1&sender_device=pc"],
        "website": "http://flibusta.site/b/668844/read"
    },
    "workAndEducation": {
        "placeOfWork": "MydataCoin",
        "skills": ["Attractive"],
        "university": "KNU",
        "faculty": "ФИиИт"
    },
    "placeOfResidence": {
        "currentCity": "New-York",
        "birthPlace": "bishkek",
        "otherCities": ["Astana","Peru","Amsterdam"]
    },
    "personalInterests": {
        "briefDescription": "Smart",
        "hobby": ["biohacking"],
        "sport": ["boxing"]
    },
    "deviceInformation": {
        "deviceName": "Mac m2 pro",
        "deviceId": "21313-asdasd-12313",
        "operatingSystem": "windows",
        "displayResolution": "999X999",
        "browser": "internet explorer",
        "iSP": "megaCom provider",
        "adBlock": true
    },
    "cookies": {
        "sessionState": "Active",
        "language": "Russia",
        "region": "chui area",
        "recentPages": ["https://ru.wikipedia.org/wiki%D0%A5%D0%BE%D0%B1%D0%B1%D0%B8%D1%85%D0%BE%D1%80%D1%81%D0%B8%D0%BD%D0%B3"],
        "shoppingCart": [
            {
                "productId": 123,
                "productName": "dragon",
                "productPrice": 100000000,
                "quantity": 1,
                "subTotal": 120000,
                "total": 20,
                "couponCode": "free-dragondotpy",
                "shippingInformation": "st.Avenue 13",
                "taxInformation": "12.23"
            },
            {
                "productId": 1233,
                "productName": "dragon-wife",
                "productPrice": 1,
                "quantity": 1,
                "subTotal": 1,
                "total": 2,
                "couponCode": "free-incubator",
                "shippingInformation": "st.Avenue 13",
                "taxInformation": "0.01"
            }
        ]
    }
}'
```

{% endtab %}

{% tab title="Java" %}

```java
// this url is designed to synchronize data in the database, that is,
// when updating your user's data, you can simultaneously 
// generate json and send it to our url so that the data is always up to date



// data = {
//     "profile": {
//         "recordId": "54",
//         "firstName": "Alex",
//         "lastName": "Vishnevski",
//         "dateOfBirth": "2002-11-09T00:00:00Z",
//         "gender": 1,
//         "email": ["amaymon02@mai8.ru"],
//         "phone": ["+996222116992", "+996555848652"],
//         "maritalStatus": 0,
//         "income": 0
//     },
//     "basicData": {
//         "interests": ["hobbyhorsing","boxing"],
//         "languages": ["english", "indian"],
//         "religionViews": ["Atheist","Agnostik"],
//         "politicalViews": ["liberal"]
//     },
//     "contacts": {
//         "mobilePhone": "IPHONE13",
//         "address": "avenue 13",
//         "linkedAccounts": ["https://www.tiktok.com/@angiejoliefan?is_from_webapp=1&sender_device=pc"],
//         "website": "http://flibusta.site/b/668844/read"
//     },
//     "workAndEducation": {
//         "placeOfWork": "MydataCoin",
//         "skills": ["Attractive"],
//         "university": "KNU",
//         "faculty": "ФИиИт"
//     },
//     "placeOfResidence": {
//         "currentCity": "New-York",
//         "birthPlace": "bishkek",
//         "otherCities": ["Astana","Peru","Amsterdam"]
//     },
//     "personalInterests": {
//         "briefDescription": "Smart",
//         "hobby": ["biohacking"],
//         "sport": ["boxing"]
//     },
//     "deviceInformation": {
//         "deviceName": "Mac m2 pro",
//         "deviceId": "21313-asdasd-12313",
//         "operatingSystem": "windows",
//         "displayResolution": "999X999",
//         "browser": "internet explorer",
//         "iSP": "megaCom provider",
//         "adBlock": True
//     },
//     "cookies": {
//         "sessionState": "Active",
//         "language": "Russia",
//         "region": "chui area",
//         "recentPages": ["https://ru.wikipedia.org/wiki/%D0%A5%D0%BE%D0%B1%D0%B1%D0%B8%D1%85%D0%BE%D1%80%D1%81%D0%B8%D0%BD%D0%B3"],
//         "shoppingCart": [
//             {
//                 "productId": "123-asda-12312",
//                 "productName": "dragon",
//                 "productPrice": 100000000,
//                 "quantity": 1,
//                 "subTotal": 120000,
//                 "total": 20,
//                 "couponCode": "free-dragondotpy",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "12.23"
//             },
//             {
//                 "productId": "123-qwe-123",
//                 "productName": "dragon-wife",
//                 "productPrice": 1,
//                 "quantity": 1,
//                 "subTotal": 1,
//                 "total": 2,
//                 "couponCode": "free-incubator",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "0.01"
//             }
//         ]
//     }
// }

public class UpdateDataExample {
    public static void Update(Object data) {
        HttpClient httpClient = HttpClient.newHttpClient();

        String url = "http://your-server-ip:8000/api/v1/update?recordId=55";
        String authToken = "your_auth_token_here";

        Map<String, String> headers = new HashMap<>();
        // here you have to pass your authorization token which you specified 
        // in docker-compose.yml file in environment variables
        headers.put("Authorization", authToken);
        headers.put("Content-Type", "application/json");

        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .headers(headers.entrySet().stream()
                        .map(entry -> entry.getKey() + ":" + entry.getValue())
                        .toArray(String[]::new))
                .PUT(HttpRequest.BodyPublishers.ofString(data))
                .build();

        try {
            HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());

            if (response.statusCode() == 200) {
                System.out.println("Data updated successfully: " + response.body());
            } else {
                System.out.println("Error updating data: " + response.body());
            }
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
// this url is designed to synchronize data in the database, that is,
// when updating your user's data, you can simultaneously 
// generate json and send it to our url so that the data is always up to date



// data = {
//     "profile": {
//         "recordId": "54",
//         "firstName": "Alex",
//         "lastName": "Vishnevski",
//         "dateOfBirth": "2002-11-09T00:00:00Z",
//         "gender": 1,
//         "email": ["amaymon02@mai8.ru"],
//         "phone": ["+996222116992", "+996555848652"],
//         "maritalStatus": 0,
//         "income": 0
//     },
//     "basicData": {
//         "interests": ["hobbyhorsing","boxing"],
//         "languages": ["english", "indian"],
//         "religionViews": ["Atheist","Agnostik"],
//         "politicalViews": ["liberal"]
//     },
//     "contacts": {
//         "mobilePhone": "IPHONE13",
//         "address": "avenue 13",
//         "linkedAccounts": ["https://www.tiktok.com/@angiejoliefan?is_from_webapp=1&sender_device=pc"],
//         "website": "http://flibusta.site/b/668844/read"
//     },
//     "workAndEducation": {
//         "placeOfWork": "MydataCoin",
//         "skills": ["Attractive"],
//         "university": "KNU",
//         "faculty": "ФИиИт"
//     },
//     "placeOfResidence": {
//         "currentCity": "New-York",
//         "birthPlace": "bishkek",
//         "otherCities": ["Astana","Peru","Amsterdam"]
//     },
//     "personalInterests": {
//         "briefDescription": "Smart",
//         "hobby": ["biohacking"],
//         "sport": ["boxing"]
//     },
//     "deviceInformation": {
//         "deviceName": "Mac m2 pro",
//         "deviceId": "21313-asdasd-12313",
//         "operatingSystem": "windows",
//         "displayResolution": "999X999",
//         "browser": "internet explorer",
//         "iSP": "megaCom provider",
//         "adBlock": True
//     },
//     "cookies": {
//         "sessionState": "Active",
//         "language": "Russia",
//         "region": "chui area",
//         "recentPages": ["https://ru.wikipedia.org/wiki/%D0%A5%D0%BE%D0%B1%D0%B1%D0%B8%D1%85%D0%BE%D1%80%D1%81%D0%B8%D0%BD%D0%B3"],
//         "shoppingCart": [
//             {
//                 "productId": "123-asda-12312",
//                 "productName": "dragon",
//                 "productPrice": 100000000,
//                 "quantity": 1,
//                 "subTotal": 120000,
//                 "total": 20,
//                 "couponCode": "free-dragondotpy",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "12.23"
//             },
//             {
//                 "productId": "123-qwe-123",
//                 "productName": "dragon-wife",
//                 "productPrice": 1,
//                 "quantity": 1,
//                 "subTotal": 1,
//                 "total": 2,
//                 "couponCode": "free-incubator",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "0.01"
//             }
//         ]
//     }
// }

const axios = require('axios');

function updateData(data) {
    const url = 'http://your-server-ip:8000/api/v1/update?recordId=55';
   // here you have to pass your authorization token which you specified 
   // in docker-compose.yml file in environment variables
    const authToken = 'your_auth_token_here';

    const headers = {
        'Authorization': authToken,
        'Content-Type': 'application/json'
    };

    axios.put(url, data, { headers })
        .then(response => {
            const responseData = response.data;
            if (response.status === 200) {
                console.log('Data updated successfully:', responseData);
            } else {
                console.log('Error updating data:', responseData);
            }
        })
        .catch(error => {
            console.error('Request error:', error);
        });
}
```

{% endtab %}

{% tab title="Python" %}

```python
# this url is designed to synchronize data in the database, that is,
# when updating your user's data, you can simultaneously 
# generate json and send it to our url so that the data is always up to date



# data = {
#     "profile": {
#         "recordId": "54",
#         "firstName": "Alex",
#         "lastName": "Vishnevski",
#         "dateOfBirth": "2002-11-09T00:00:00Z",
#         "gender": 1,
#         "email": ["amaymon02@mai8.ru"],
#         "phone": ["+996222116992", "+996555848652"],
#         "maritalStatus": 0,
#         "income": 0
#     },
#     "basicData": {
#         "interests": ["hobbyhorsing","boxing"],
#         "languages": ["english", "indian"],
#         "religionViews": ["Atheist","Agnostik"],
#         "politicalViews": ["liberal"]
#     },
#     "contacts": {
#         "mobilePhone": "IPHONE13",
#         "address": "avenue 13",
#         "linkedAccounts": ["https://www.tiktok.com/@angiejoliefan?is_from_webapp=1&sender_device=pc"],
#         "website": "http://flibusta.site/b/668844/read"
#     },
#     "workAndEducation": {
#         "placeOfWork": "MydataCoin",
#         "skills": ["Attractive"],
#         "university": "KNU",
#         "faculty": "ФИиИт"
#     },
#     "placeOfResidence": {
#         "currentCity": "New-York",
#         "birthPlace": "bishkek",
#         "otherCities": ["Astana","Peru","Amsterdam"]
#     },
#     "personalInterests": {
#         "briefDescription": "Smart",
#         "hobby": ["biohacking"],
#         "sport": ["boxing"]
#     },
#     "deviceInformation": {
#         "deviceName": "Mac m2 pro",
#         "deviceId": "21313-asdasd-12313",
#         "operatingSystem": "windows",
#         "displayResolution": "999X999",
#         "browser": "internet explorer",
#         "iSP": "megaCom provider",
#         "adBlock": True
#     },
#     "cookies": {
#         "sessionState": "Active",
#         "language": "Russia",
#         "region": "chui area",
#         "recentPages": ["https://ru.wikipedia.org/wiki/%D0%A5%D0%BE%D0%B1%D0%B1%D0%B8%D1%85%D0%BE%D1%80%D1%81%D0%B8%D0%BD%D0%B3"],
#         "shoppingCart": [
#             {
#                 "productId": "123-asda-12312",
#                 "productName": "dragon",
#                 "productPrice": 100000000,
#                 "quantity": 1,
#                 "subTotal": 120000,
#                 "total": 20,
#                 "couponCode": "free-dragondotpy",
#                 "shippingInformation": "st.Avenue 13",
#                 "taxInformation": "12.23"
#             },
#             {
#                 "productId": "123-qwe-123",
#                 "productName": "dragon-wife",
#                 "productPrice": 1,
#                 "quantity": 1,
#                 "subTotal": 1,
#                 "total": 2,
#                 "couponCode": "free-incubator",
#                 "shippingInformation": "st.Avenue 13",
#                 "taxInformation": "0.01"
#             }
#         ]
#     }
# }


def update_data(data):
    url = 'http://your-server-ip:8000/api/v1/update?recordId=55'
   # here you have to pass your authorization token which you specified 
   # in docker-compose.yml file in environment variables
    auth_token = 'your_auth_token_here'

    headers = {
        'Authorization': auth_token,
        'Content-Type': 'application/json'
    }

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

        if response.status_code == 200:
            print('Data updated successfully:', response_data)
        else:
            print('Error updating data:', response_data)

    except requests.exceptions.RequestException as e:
        print('Request error:', e)

```

{% endtab %}

{% tab title="C#" %}

```csharp
// this url is designed to synchronize data in the database, that is,
// when updating your user's data, you can simultaneously 
// generate json and send it to our url so that the data is always up to date


// data = {
//     "profile": {
//         "recordId": "54",
//         "firstName": "Alex",
//         "lastName": "Vishnevski",
//         "dateOfBirth": "2002-11-09T00:00:00Z",
//         "gender": 1,
//         "email": ["amaymon02@mai8.ru"],
//         "phone": ["+996222116992", "+996555848652"],
//         "maritalStatus": 0,
//         "income": 0
//     },
//     "basicData": {
//         "interests": ["hobbyhorsing","boxing"],
//         "languages": ["english", "indian"],
//         "religionViews": ["Atheist","Agnostik"],
//         "politicalViews": ["liberal"]
//     },
//     "contacts": {
//         "mobilePhone": "IPHONE13",
//         "address": "avenue 13",
//         "linkedAccounts": ["https://www.tiktok.com/@angiejoliefan?is_from_webapp=1&sender_device=pc"],
//         "website": "http://flibusta.site/b/668844/read"
//     },
//     "workAndEducation": {
//         "placeOfWork": "MydataCoin",
//         "skills": ["Attractive"],
//         "university": "KNU",
//         "faculty": "ФИиИт"
//     },
//     "placeOfResidence": {
//         "currentCity": "New-York",
//         "birthPlace": "bishkek",
//         "otherCities": ["Astana","Peru","Amsterdam"]
//     },
//     "personalInterests": {
//         "briefDescription": "Smart",
//         "hobby": ["biohacking"],
//         "sport": ["boxing"]
//     },
//     "deviceInformation": {
//         "deviceName": "Mac m2 pro",
//         "deviceId": "21313-asdasd-12313",
//         "operatingSystem": "windows",
//         "displayResolution": "999X999",
//         "browser": "internet explorer",
//         "iSP": "megaCom provider",
//         "adBlock": True
//     },
//     "cookies": {
//         "sessionState": "Active",
//         "language": "Russia",
//         "region": "chui area",
//         "recentPages": ["https://ru.wikipedia.org/wiki/%D0%A5%D0%BE%D0%B1%D0%B1%D0%B8%D1%85%D0%BE%D1%80%D1%81%D0%B8%D0%BD%D0%B3"],
//         "shoppingCart": [
//             {
//                 "productId": "123-asda-12312",
//                 "productName": "dragon",
//                 "productPrice": 100000000,
//                 "quantity": 1,
//                 "subTotal": 120000,
//                 "total": 20,
//                 "couponCode": "free-dragondotpy",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "12.23"
//             },
//             {
//                 "productId": "123-qwe-123",
//                 "productName": "dragon-wife",
//                 "productPrice": 1,
//                 "quantity": 1,
//                 "subTotal": 1,
//                 "total": 2,
//                 "couponCode": "free-incubator",
//                 "shippingInformation": "st.Avenue 13",
//                 "taxInformation": "0.01"
//             }
//         ]
//     }
// }

namespace UpdateDataExample
{
    class Program
    {
        static async Task Update(Object data)
        {
            string url = "http://your-server-ip:8000/api/v1/update?recordId=55";
            string authToken = "your_auth_token_here";

            HttpClient httpClient = new HttpClient();
            // here you have to pass your authorization token which you specified 
            // in docker-compose.yml file in environment variables
            httpClient.DefaultRequestHeaders.Add("Authorization", authToken);
            httpClient.DefaultRequestHeaders.Add("Content-Type", "application/json");

            try
            {
                HttpResponseMessage response = await httpClient.PutAsync(url, new StringContent(data, Encoding.UTF8, "application/json"));
                string responseData = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    Console.WriteLine("Data updated successfully: " + responseData);
                }
                else
                {
                    Console.WriteLine("Error updating data: " + responseData);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Request error: " + e.Message);
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}


# Become a Validator

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

Will be announced soon...


# Widget

This section describes how you can embed the MyDataCoin functionality, as a widget, into your mobile application.

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

{% hint style="danger" %}
This functionality is available only on the territory of the Kyrgyz Republic.
{% endhint %}

Before you start working, you must log in to the service. To do this, you need to pass the header in each request:

Bearer {token}


# For Data Сonsumers

In this section, you will find information on how to integrate with the service for providing legal consent for the transfer and processing of personal data.

{% hint style="info" %}
**Disclaimer:** The development team is working diligently, and the documentation will be updated with each new release.
{% endhint %}

{% hint style="danger" %}
This functionality is available only on the territory of the Kyrgyz Republic.
{% endhint %}

Before you start you need to get an Authorization Token(Bearer). Please talk to our team to obtain the token.

If you need to get a consent from user, you need to create an application first. To do that you need to make a POST request.

{% openapi src="/files/rz264aorRjDkV7UoLoVz" path="/api/v1/Application/create-application" method="post" %}
[swagger.json](https://2208573175-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXon1RMnj85mP22gR5Ex8%2Fuploads%2FkcpVD6RB2UwyZLeq5qfa%2Fswagger.json?alt=media\&token=80bfa062-e116-4142-8472-e247331c6c4f)
{% endopenapi %}

Once the application is created, you must wait for the user to provide their official consent. While waiting you might request status of application.

{% openapi src="/files/rz264aorRjDkV7UoLoVz" path="/api/v1/Application/get-application-by-id/{id}" method="get" %}
[swagger.json](https://2208573175-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXon1RMnj85mP22gR5Ex8%2Fuploads%2FkcpVD6RB2UwyZLeq5qfa%2Fswagger.json?alt=media\&token=80bfa062-e116-4142-8472-e247331c6c4f)
{% endopenapi %}

Also you can get appliction by its application number.

{% openapi src="/files/rz264aorRjDkV7UoLoVz" path="/api/v1/Application/get-application-by-application-number" method="get" %}
[swagger.json](https://2208573175-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXon1RMnj85mP22gR5Ex8%2Fuploads%2FkcpVD6RB2UwyZLeq5qfa%2Fswagger.json?alt=media\&token=80bfa062-e116-4142-8472-e247331c6c4f)
{% endopenapi %}


# Downloads

Here you can find additional files to download

{% file src="/files/IjTA3e4hVEQ1NWCP4TRT" %}
Brandbook
{% endfile %}

{% file src="/files/AZjTvc0IprLbpguChBHk" %}
Pitch Deck (English)
{% endfile %}

{% file src="/files/27q8wNqP3QyvxICoZhnK" %}
Pitch Deck (Russian)
{% endfile %}


