Contas Bancárias (DepositAccount)

As contas bancárias representam contas correntes, investimento, carteira, etc, dos usuários. Ela agrupam todos os lançamentos (FinancialTransaction), e são agrupadas dentro das suas respectivas Entidades (Entity).

Listar contas bancárias

GET /entities/:entity_id/deposit_accounts

Exibe os atributos da conta bancária especificada, retornando 200 Ok.

Exemplo de Resposta

HTTP/1.1 200 OK
Date: Mon, 17 Jan 2011 20:00:02 GMT
Content-Type: application/json; charset=utf-8
[
  {
    "deposit_account":
      {
        "archive":false,
        "bank_account_id":null,
        "created_at":"2011-05-17T10:19:15-03:00",
        "currency_id":1,
        "deposit_account_type_id":2,
        "description":null,
        "entity_id":67,
        "force_destroy":false,
        "id":129,
        "imported_from_sync":false,
        "initial_balance":null,
        "last_transaction_date":null,
        "name":"Caixa Pequeno",
        "sync_response":null,
        "updated_at":"2011-05-17T10:19:15-03:00",
        "calculated_balance":"34290.11",
        "logo_image_url":"logos/logo-bank-bradesco.png",
        "links":[{"rel":"self","href":"http://app.myfinance.com.br/entities/67/deposit_accounts/129","method":"get"}]
      }
    }
  ]
HTTP/1.1 200 OK
Date: Mon, 17 Jan 2011 20:00:02 GMT
Content-Type: application/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<deposit-accounts type="array">
  <deposit-account>
    <archive type="boolean">false</archive>
    <bank-account-id type="integer" nil="true"/>
    <created-at type="datetime">2011-05-17T10:19:15-03:00</created-at>
    <currency-id type="integer">1</currency-id>
    <deposit-account-type-id type="integer">2</deposit-account-type-id>
    <description nil="true"/>
    <entity-id type="integer">67</entity-id>
    <force-destroy type="boolean">false</force-destroy>
    <id type="integer">129</id>
    <imported-from-sync type="boolean">false</imported-from-sync>
    <initial-balance type="decimal" nil="true"/>
    <last-transaction-date type="date" nil="true"/>
    <name>Caixa Pequeno</name>
    <sync-response type="yaml" nil="true"/>
    <updated-at type="datetime">2011-05-17T10:19:15-03:00</updated-at>
    <calculated-balance type="decimal">34290.11</calculated-balance>
    <logo-image-url>logos/logo-money-account.png</logo-image-url>
    <links type="array">
      <link>
        <rel>self</rel>
        <href>http://app.myfinance.com.br/entities/67/deposit_accounts/129</href>
        <method>get</method>
      </link>
    </links>
  </deposit-account>
</deposit-accounts>

Exemplo de Busca Avançada

GET /entities/:entity_id/deposit_accounts?search[name]=name

Filtros disponíveis para Busca Avançada

- deposit_account_type_id  | Id da conta no Myfinance
- bank_account_id          | Id do banco no Myfinance
- name                     | Nome exato da Conta
- name_contains            | Nome contendo o critério informado
- description              | Descrição de forma exata
- description_contains     | Descrição com o critério informado
- description_is_null      | Descrição é nulo

Exibir uma conta bancária

GET /entities/:entity_id/deposit_accounts/:id

Exibe os atributos da conta bancária especificada retornando 200 Ok.

Exemplo de Resposta

HTTP/1.1 200 OK
Date: Mon, 17 Jan 2011 20:00:02 GMT
Content-Type: application/json; charset=utf-8
{
  "deposit_account":
    {
      "archive":false,
      "bank_account_id":null,
      "created_at":"2011-05-17T10:19:15-03:00",
      "currency_id":1,
      "deposit_account_type_id":2,
      "description":null,
      "entity_id":67,
      "force_destroy":false,
      "id":129,
      "imported_from_sync":false,
      "initial_balance":null,
      "last_transaction_date":null,
      "name":"Caixa Pequeno",
      "sync_response":null,
      "updated_at":"2011-05-17T10:19:15-03:00",
      "calculated_balance":"34290.11",
      "logo_image_url":"logos/logo-bank-bradesco.png",
      "links":[{"rel":"self","href":"http://app.myfinance.com.br/entities/67/deposit_accounts/129","method":"get"}]

    }
  }
HTTP/1.1 200 OK
Date: Mon, 17 Jan 2011 20:00:02 GMT
Content-Type: application/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<deposit-account>
  <archive type="boolean">false</archive>
  <bank-account-id type="integer" nil="true"/>
  <created-at type="datetime">2011-05-17T10:19:15-03:00</created-at>
  <currency-id type="integer">1</currency-id>
  <deposit-account-type-id type="integer">2</deposit-account-type-id>
  <description nil="true"/>
  <entity-id type="integer">67</entity-id>
  <force-destroy type="boolean">false</force-destroy>
  <id type="integer">129</id>
  <imported-from-sync type="boolean">false</imported-from-sync>
  <initial-balance type="decimal" nil="true"/>
  <last-transaction-date type="date" nil="true"/>
  <name>Caixa Pequeno</name>
  <sync-response type="yaml" nil="true"/>
  <updated-at type="datetime">2011-05-17T10:19:15-03:00</updated-at>
  <calculated-balance type="decimal">34290.11</calculated-balance>
  <logo-image-url>logos/logo-money-account.png</logo-image-url>
  <links type="array">
    <link>
      <rel>self</rel>
      <href>http://app.myfinance.com.br/entities/67/deposit_accounts/129</href>
      <method>get</method>
    </link>
  </links>
</deposit-account>

Criar conta bancária

POST /entities/:entity_id/deposit_accounts

Cria uma nova conta bancária do tipo especificado.

HTTP/1.1 201 Created
Date: Mon, 17 Jan 2011 20:29:57 GMT
Content-Type: application/json; charset=utf-8
Location: https://app.myfinance.com.br/entities/67/deposit_accounts/2
{
  "deposit_account":
    {
      "currency_id":1,
      "bank-account-id ":141,
      "deposit_account_type_id":2,
      "entity_id":67,
      "id":129,
      "name":"Caixa Pequeno"
    }
  }
HTTP/1.1 201 Created
Date: Mon, 17 Jan 2011 20:29:57 GMT
Content-Type: application/xml; charset=utf-8
Location: https://app.myfinance.com.br/entities/67/deposit_accounts/2
<deposit-account>
  <bank-account-id type="integer">141</bank-account-id>
  <currency-id type="integer">1</currency-id>
  <deposit-account-type-id type="integer">1</deposit-account-type-id>
  <entity-id type="integer">67</entity-id>
  <id type="integer">129</id>
  <name>Caixa Pequeno</name>
</deposit-account>

Alterar uma conta bancária

PUT /entities/:entity_id/deposit_accounts/:id

Altera os dados da conta bancárias especificada. Retorna uma resposta vazia com status 200 OK.

Em caso de erro, retorna os erros que impediram de alterar a conta.

Exemplo de Requisição

{
  "deposit_account":
    {
      "currency_id":1,
      "deposit_account_type_id":2,
      "entity_id":67,
      "id":129,
      "name":"Caixa Pequeno"
    }
  }
<deposit-account>
  <currency-id type="integer">1</currency-id>
  <deposit-account-type-id type="integer">2</deposit-account-type-id>
  <entity-id type="integer">67</entity-id>
  <id type="integer">129</id>
  <name>Caixa Pequeno</name>
</deposit-account>

Apagar uma conta bancária

Exemplo de Requisição

DELETE /entities/:entity_id/deposit_accounts/:id

Apaga a conta bancária especificada. Todos os recursos associados à esta conta bancária também serão apagados! Retorna uma resposta vazia com status 200 OK.