# API de Aplicações

## createApplication

`POST` `https://api.pushwoosh.com/json/1.3/createApplication`

Cria um novo aplicativo na conta.

#### Corpo da Requisição

| Nome | Tipo | Descrição |
| :--- | :--- | :--- |
| authorize\_all\_tokens | boolean | Permite que todos os tokens de API se comuniquem com este aplicativo. |
| auth\* | string | [Token de acesso à API](/pt/developer/api-reference/api-identifiers/#api-access-token) do Painel de Controle Pushwoosh. |
| icon | string | Conteúdo binário codificado em Base64 de um arquivo png. |
| sdk\_ios | string | Tipo de SDK iOS. Valores possíveis: "pw" ou "corona". Para Corona, o payload do push é diferente. |
| sdk\_android | string | Tipo de SDK Android. Valores possíveis: "pw", "corona", "phonegap". Usuários do AppPresser selecionam "phonegap". |
| title\* | string | Título para o novo aplicativo no Pushwoosh. |

Exemplo de resposta:
```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": {
    "application": "1DC69-73EDB"
  }
}
```

Exemplo de código:
```
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H",          // required. API access token from Pushwoosh Control Panel
    "icon": "iVBORw0KGgoAAAANSUhEUgAAA...",  // optional. Base-64 encoded binary content of png file 
    "authorize_all_tokens": true,            // optional. If true, allows all api tokens to communicate with this app
    "sdk_ios": "pw",                         // optional. Possible values are "pw" or "corona"
    "sdk_android": "pw",                     // optional. Possible values are "pw", "corona", or "phonegap"
    "title": "APP_TITLE"                     // required. Title for the new app in Pushwoosh
  }
}
```

## updateApplication

`POST` `https://api.pushwoosh.com/json/1.3/updateApplication`

Atualiza as configurações do aplicativo.

#### Corpo da Requisição

| Nome | Tipo | Descrição |
| :--- | :--- | :--- |
| auth\* | string | [Token de acesso à API](/pt/developer/api-reference/api-identifiers/#api-access-token) do Painel de Controle Pushwoosh. |
| application\* | string | [Código do aplicativo Pushwoosh](/pt/developer/api-reference/api-identifiers/#application-code) |
| icon | string | Conteúdo binário codificado em Base64 de um arquivo png. |
| sdk\_ios | string | Tipo de SDK iOS. Valores possíveis: "pw" ou "corona". Para Corona, o payload do push é diferente. |
| sdk\_android | string | Tipo de SDK Android. Valores possíveis: "pw", "corona", "phonegap". Usuários do AppPresser selecionam "phonegap". |
| title | string | Novo título para o aplicativo no Pushwoosh. |

<Tabs>
<TabItem label="200">
```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": null
}
```
</TabItem>
</Tabs>

```json title="Example"
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H",     // required. API access token from Pushwoosh Control Panel
    "application": "XXXXX-XXXXX",       // required. application code of the app you want to update
    "icon": "iVBORw0KGgoAAAANSUD6...",  // optional. Base-64 encoded binary content of png file 
    "sdk_ios": "pw",                    // optional. Possible values are "pw" or "corona"
    "sdk_android": "pw",                // optional. Possible values are "pw", "corona", or "phonegap"
    "title": "APP_TITLE"                // optional. New title for the app in Pushwoosh
  }
}
```

## deleteApplication

`POST` `https://api.pushwoosh.com/json/1.3/deleteApplication`

Exclui o aplicativo da conta.

#### Corpo da Requisição

| Nome | Tipo | Descrição |
| :--- | :--- | :--- |
| auth\* | string | [Token de acesso à API](/pt/developer/api-reference/api-identifiers/#api-access-token) do Painel de Controle Pushwoosh. |
| application\* | string | [Código do aplicativo Pushwoosh](/pt/developer/api-reference/api-identifiers/#application-code) |

<Tabs>
<TabItem label="200">
```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": null
}
```
</TabItem>
</Tabs>

```json title="Example"
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H", // required. API access token from Pushwoosh Control Panel
    "application": "XXXXX-XXXXX"    // required. Pushwoosh application code
  }
}
```

## getApplication

`POST` `https://api.pushwoosh.com/json/1.3/getApplication`

Obtém detalhes sobre o aplicativo.

#### Corpo da Requisição

| Nome | Tipo | Descrição |
| :--- | :--- | :--- |
| auth\* | string | [Token de acesso à API](/pt/developer/api-reference/api-identifiers/#api-access-token) do Painel de Controle Pushwoosh. |
| application\* | string | [Código do aplicativo Pushwoosh](/pt/developer/api-reference/api-identifiers/#application-code) |

<Tabs>
<TabItem label="200">
```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": {
    "application": {
      "adm_cid": "",
      "adm_secret": "",
      "android_api_type": "x31",
      "android_gcm_api_key": "x7836363631366236353566366236353739",
      "android_sdk": "x7077",
      "icon_url": null,
      "ios_gateway": "x783330",
      "ios_key_management_type": "x783631373537343666",
      "ios_key_password": "x7836353336363236353335333736353333",
      "ios_sdk": "x7077",
      "title": "0 Application For test",
      "providers": {
        "ios": true,
        "amazon": false,
        "android": false,
        "baidu_android": false,
        "chrome": false,
        "email": false,
        "firefox": false,
        "huawei_android": false,
        "internet_explorer": false,
        "osx": false,
        "safari": false,
        "sms": false,
        "web": false,
        "whats_app": false,
        "windows": false
      },
      "languages": {
        "en": "34",
        "zh": "12",
        "sv": "7",
        "de": "6",
        "pt": "6"
      }
    }
  }
}
```
</TabItem>
</Tabs>

```
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H", // required API access token from Pushwoosh Control Panel
    "application": "XXXXX-XXXXX"    // required. Pushwoosh application code
  }
}
```

## getApplications

`POST` `https://api.pushwoosh.com/json/1.3/getApplications`

Obtém a lista de aplicativos na conta. Pode retornar resultados com paginação.

#### Corpo da Requisição

| Nome | Tipo | Descrição |
| :--- | :--- | :--- |
| auth\* | string | [Token de acesso à API](/pt/developer/api-reference/api-identifiers/#api-access-token) do Painel de Controle Pushwoosh. |
| page | integer | O número da página para paginação. |

#### Exemplo de requisição

```
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H",  // required. API access token from Pushwoosh Control Panel
    "page": 2                        // optional. The page number for pagination
  }
}
```

#### Resposta

Se houver mais de 100 aplicativos na conta, a resposta inclui `current page` e `total amount of pages`.

#### Exemplo de Resposta

```
{
  "status_code": 200,
  "status_message": "OK",
  "response": {
    "page": 1,   // Current page
    "total": 2,  // Total amount of pages
    "applications": [{
      "APPLICATION_CODE": "MyApp1"
    }, {
      "APPLICATION_CODE": "MyApp2"
    }]
  }
}
```

## getApplicationFile

`POST` `https://api.pushwoosh.com/json/1.3/getApplicationFile`

Obtém os arquivos de configuração relacionados ao aplicativo.

#### Corpo da Requisição

| Nome | Tipo | Descrição |
| :--- | :--- | :--- |
| auth\* | string | [Token de acesso à API](/pt/developer/api-reference/api-identifiers/#api-access-token) do Painel de Controle Pushwoosh. |
| application\* | string | [Código do aplicativo Pushwoosh](/pt/developer/api-reference/api-identifiers/#application-code) |
| file\* | string | Identificador do arquivo a ser recuperado. Veja os valores abaixo. |

<Tabs>
<TabItem label="200">
```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": null
}
```
</TabItem>
</Tabs>

```json title="Example"
{
  "request": {
    "auth": "yxoPUlwqm…………pIyEX4H",  // required. API access token from Pushwoosh Control Panel
    "application": "XXXXX-XXXXX",    // required. Pushwoosh application code
    "file": "ios_auto_privatekey"    // required. identifier of the file to retrieve. See values below
  }
}
```

#### Valores possíveis para o parâmetro "file":

`"ios_auto_privatekey" | "ios_manual_privatekey" | "ios_auto_certificate" | "ios_manual_certificate" | "ios_push_certificate" | "ios_provisioning_profile" | "macos_manual_privatekey" | "macos_manual_certificate" | "macos_push_certificate" | "safari_manual_privatekey" | "safari_push_certificate" | "safari_push_package"`

**Exemplo de resposta**:

```
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
```

## setApplicationPlatformStatus

`POST` `https://api.pushwoosh.com/json/1.3/setApplicationPlatformStatus`

Altera o status da plataforma do aplicativo.

#### Corpo da Requisição

| Nome | Tipo | Descrição |
| :--- | :--- | :--- |
| auth\* | string | [Token de acesso à API](/pt/developer/api-reference/api-identifiers/#api-access-token) do Painel de Controle Pushwoosh. |
| application\* | string | [Código do aplicativo Pushwoosh](/pt/developer/api-reference/api-identifiers/#application-code) |
| platform\* | integer | O tipo de plataforma. Veja a lista de tipos de plataforma abaixo. |
| status\* | string | "enable" ou "disable" |

<Tabs>
<TabItem label="200">
```json
{
  "status_code": 200,
  "status_message": "OK",
  "response": {
    "message": "iOS pushes are disabled",
    "available_platforms": {
      "iOS": false,
      "Android": true,
      "OS X": false,
      "Windows": false,
      "Amazon": false,
      "Safari": false,
      "Chrome": true,
      "Firefox": false,
    }
  }
}
```
</TabItem>
</Tabs>

```json title="Example"
{
  "request": {
    "application": "XXXXX-XXXXX",   // required. Pushwoosh application code
    "auth": "yxoPUlwqm…………pIyEX4H", // required. API access token from Pushwoosh Control Panel
    "platform": 1,                  // required. 1 — iOS; 3 — Android; 7 — Mac OS X; 8 — Windows;
                                    //           9 — Amazon; 10 — Safari; 11 — Chrome; 12 — Firefox;
    "status": "disable"             // required. "disable" or "enable"
  }
}
```