Documentação Joomag API 2.0

Revistas

Obter Lista de Revistas

Devolve a lista de revistas da sua conta.

GET /api/2.0/magazines

Exemplo:

Obter todas as revistas da sua conta.

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# Make the call to the client.
$result = $jmClient->getMagazinesList();

Resposta:

{
  "error": 0,
  "message": "OK",
  "data": [
    {
      "ID": "M0250759001409245540",
      "title": "Cars Magazine Pro",
      "description": "Cars Magazine Pro",
      "language": "es",
      "type": 1,
      "category": 8,
      "adult_content": true,
      "subscription_status": "disabled"
    },
    {
      "ID": "M0863068001409245778",
      "title": "Health & Fitness",
      "description": "",
      "language": "en",
      "type": 1,
      "category": null,
      "adult_content": false,
      "subscription_status": "paid",
      "price": 24.99,
      "issue_price": 1.99,
      "preview_pages": "2-6"
    },
    {
      "ID": "M0166830001409317679",
      "title": "IT Mag",
      "description": "",
      "language": "en",
      "type": 1,
      "category": 186,
      "adult_content": false,
      "subscription_status": "free",
      "subscribe_popup": "auto_open"
    }
  ]
}

Listar Edições da Revista

Devolve lista de edições da revista solicitada.

GET /api/2.0/magazines/<id>/issues

Exemplo:

Obter todas as edições da revista

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# ID of the magazine
$magazineID = 'M0250759001409245540';

# Make the call to the client.
$result = $jmClient->get( "magazines/$magazineID/issues" );

Resposta:

{
  "error": 0,
  "message": "OK",
  "data": [
    {
      "ID": "0727865001409319307",
      "title": "Cars Magazine Pro Aug 2014",
      "volume": "Aug 2014",
      "description": "",
      "language": "es",
      "type": 1,
      "category": 8,
      "category2": null,
      "price": 0,
      "privacy_level": "private",
      "creation_date": "2014-08-29 08:35:07",
      "page_height": 841,
      "page_width": 595,
      "preview_pages": null,
      "adult_content": false,
      "pages_count": 16,
      "cover": "http:\/\/s1.joomag.com\/res_mag\/0\/178\/178119\/316889\/thumbs\/7461943.jpg",
      "mobile_support": false,
      "allow_download": false,
      "allow_print": false,
      "tags": ["luxury", "retro", "exclusive"]
    },
    {
      "ID": "0649338001409248394",
      "title": "Cars Magazine Pro Jun 2014",
      "volume": "Jun 2014",
      "description": "",
      "language": "en",
      "type": 1,
      "category": null,
      "category2": 189,
      "price": 0,
      "privacy_level": "public",
      "creation_date": "2014-08-28 12:53:14",
      "page_height": 841,
      "page_width": 595,
      "preview_pages": null,
      "adult_content": false,
      "pages_count": 6,
      "cover": "http:\/\/s1.joomag.com\/res_mag\/0\/178\/178119\/316381\/thumbs\/7448638.jpg",
      "mobile_support": false,
      "allow_download": true,
      "allow_print": true,
      "tags": ["cars", "bmw", "4x4"]
    }
  ]
}

Obter Detalhes da Revista

Devolve as propriedades da revista solicitada.

GET /api/2.0/magazines/<id>

Exemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# ID of the magazine
$magazineID = 'M0250759001409245540';

# Make the call to the client.
$result = $jmClient->getMagazineDetails( $magazineID );

Resposta:

{
  "error": 0,
  "message": "OK",
  "data": {
    "ID": "M0250759001409245540",
    "title": "Cars Magazine Pro",
    "description": "Cars Magazine Pro",
    "language": "es",
    "type": 1,
    "category": 8,
    "adult_content": true,
    "subscription_status": "disabled"
  }
}

Criar Revista

Cria revista com o título dado e com a descrição.

POST /api/2.0/magazines
Parâmetro Tipo Explicação
title cadeia Título da revista
description cadeia Descrição da revista

Exemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

$title = 'Cars Magazine';
$description = '';

# Make the call to the client.
$result = $jmClient->createMagazine( $title, $description );

Resposta:

{
  "error": 0,
  "message": "OK",
  "data": {
    "ID": "M0331611001409321232",
    "title": "Cars Magazine",
    "description": "",
    "language": "en",
    "type": 1,
    "category": null,
    "adult_content": false,
    "subscription_status": "disabled"
  }
}

Ativar Assinatura

Ativar assinatura da revista solicitada.

POST /api/2.0/magazines/<id>/subscription

Exemplo:

Ativar assinatura gratuita da revista.

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# ID of the magazine
$magazineID = "M0250759001409245540";

# Make the call to the client.
$result = $jmClient->post( "magazines/$magazineID/subscription" );

Resposta:

{
  "error": 0,
  "message": "OK",
  "data": []
}

Excluir Revista

Excluir revista solicitada com todas as suas edições.

DELETE /api/2.0/magazines/<id>
Parâmetro Tipo Explicação
confirm cadeia Deve ter o seguinte valor: Estou ciente de que desejo deletar uma revista inteira com todas as edições
confirm2 cadeia Deve ter o seguinte valor: Estou ciente também de que não poderei recupera-la
confirm3 cadeia Deve ter o seguinte valor: e não entrarei em contato com o suporte ao cliente pedindo que me devolvam

Exemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# ID of the magazine
$magazineID = 'M0863068001409245778';

# Make the call to the client.
$result = $jmClient->deleteMagazine( $magazineID,
    'I do realize I want to delete an entire magazine with all issues',
    'I also realize that I will not have it back',
    'and I will not contact customer support asking to bring it back'
);

Resposta:

{
  "error": 0,
  "message": "OK",
  "data": []
}

Desativar Assinatura

Desativar assinatura da revista solicitada.

DELETE /api/2.0/magazines/<id>/subscription

Exemplo:

Desativar assinatura gratuita da revista.

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# ID of the magazine
$magazineID = "M0250759001409245540";

# Make the call to the client.
$result = $jmClient->delete( "magazines/$magazineID/subscription" );

Resposta:

{
  "error": 0,
  "message": "OK",
  "data": []
}

Atualizar detalhes da revista

Atualizar propriedades da revista solicitada.

PUT /api/2.0/magazines/<id>
Parâmetro Tipo Explicação
title cadeia Título da revista
description cadeia Descrição da revista
adult_content bool Bandeira booleana que indica se a revista contém conteúdo adulto, deve ter valor de no ou yes
lang cadeia ID do idioma da revista, uma constante da Lista de Idiomas
type int Tipo da revista, uma constante da Lista de Tipos de Revista
cat int Categoria da revista, uma constante da Lista de Categorias da Revista

Exemplo:

# Include the API wrapper class (see "Libraries" for instructions)
require 'JoomagREST.php';

# Instantiate the client.
$jmClient = new JoomagREST(
    'api_de81b9eb3ff797796edc0cd00020b6c8',
    'sec_e8ff4e7e74c64fcfd63dcf728040ba3e5b29aa398e5cc1cb414011661c75fd19'
);

# ID of the magazine
$magazineID = 'M0250759001409245540';

# Make the call to the client.
$result = $jmClient->updateMagazine( $magazineID, array(
    "title" => "Cars Magazine Pro",
    "description" => "Cars Magazine Pro",
    "adult_content" => 'yes',
    "lang" => 'es',
    "category" => JoomagREST::CAT_AUTOMOTIVE,
));

Resposta:

{
  "error": 0,
  "message": "OK",
  "data": {
    "ID": "M0250759001409245540",
    "title": "Cars Magazine Pro",
    "description": "Cars Magazine Pro",
    "language": "es",
    "type": 1,
    "category": 8,
    "adult_content": true,
    "subscription_status": "disabled"
  }
}