Skip to content

Repository that has all CloudBlue Connect Reports for Devi

Notifications You must be signed in to change notification settings

TelefonicaTC2Tech/devi-connect-reports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

devi-connect-reports

This repository contains all CloudBlue Connect Reports for Devi

1. Report templates list

  • POC report This report can be used as template to create other reports. It only filters by date and returns Id and Asset Id.

2. Report templates development

Report templates are configured and developed creating or editing several files.

Custom report templates can be generated using Cookiecutter for CloudBlue Connect Reports too.

2.1 Reports.json file

This file contains information about all report templates.

2.1.1 Parameters

This section contains all the parameters that can be used to filter data in order to generate the report.

Type Example Overview
“product” {
    "id":"product",
    "type":"product",
    "name":"Product list",
    "required":true,
    "description":"Select the products you want to include in report"
}
This parameter type represents your product list. Use the provided example to include specified products to your report.
“marketplace” {
    "id":"mkp",
    "type":"marketplace",
    "name":"Marketplaces",
    "required":true,
    "description":"Select the marketplaces you want to include in report"}
This parameter type defines your marketplaces. Include specified marketplaces to your report by using this example.
"hub" {
    "id":"hub",
    "type":"hub",
    "name":"Hubs",
    "required":true,
    "description":"Select the hubs you want to include in report"}
This parameter type represents your hub list. Include selected hubs by using the provided example.
"date_range" {
    "id":"date",
    "type":"date_range",
    "name":"Report period",
    "description":"Provide the time period to create the report",
    "required": true}
This parameter type is used to define your report date range. Specify your start date and end date by using this parameter type. Use the provided example to include and specify your report date range.
"date" {
    "id":"date",
    "type":"date",
    "name":"date",
    "required":true,
    "description":"Select the date you want"}
This parameter type is used to specify your report date. Include a date parameter by following the provided example.
"object" {
    "id":"object",
    "type":"object",
    "name":"object",
    "required":true,
    "description":"give me a json object"}
Use this parameter type to include a JSON object.
"single_line" {
    "id":"single_line",
    "type":"single_line",
    "name":"Single line",
    "required":true,
    "description":"Tell me how you feel today in 1 sentence"}
Include a single line by using this particular parameter type.
"checkbox" {
    "id":"rr_type",
    "type":"checkbox",
    "name":"Types of requests",
    "required":true,
    "description":"Select the type of requests you want to include in report",
    "choices":
    [
        {
            "value":"setup",
            "label":"Setup"
        },
        {
            "value":"update",
            "label":"Update"
        }
    ]
}
This parameter type allows utilizing checkboxes. Thus, by using these checkboxes, you can include specific information within your report. Define your checkboxes within the choices array.
The provided example showcases how to include tier configuration requests and setup/update checkboxes to a report.
"choice" {
    "id":"rr_status",
    "type":"choice",
    "name":"Request status",
    "description":"Select the status of the requests you want to include in report",
    "required":true,
    "choices":
    [
        {
            "value":"tiers_setup",
            "label":"Tier Setup"
        },
        {
            "value":"inquiring",
            "label":"Inquiring"
        },
        {
            "value":"pending",
            "label":"Pending"
        },
        {
            "value":"approved",
            "label":"Approved"
        },
        {
            "value":"failed",
            "label":"Failed"
        }
    ]
}
Include specified information to your report and filter out unwanted data via this parameter type and specified choices. Define your filters within the choices array.
The provided example demonstrates how to include fulfillment requests and their available statuses as choices to a report.

2.1.2 Renderers

Renderers define outpuf file type: xlsx, json, xml, csv or pdf

2.1 Entrypoint file

This python file implements parameter transformation into RQL request and data transformation from received response to file.

3. Report tools

Reports can be generated using cli before tagging repository and uploading it to Connect. It requires Connect cli

Install Connect cli

To use connect-cli you need a system with python 3.8 or later installed.

Linux

    $ pip install --upgrade connect-cli

Mac OS

To install connect-cli with homebrew run:

    $ brew update
    $ brew tap cloudblue/connect
    $ brew install cloudblue/connect/connect-cli

Windows

An installer package is available for Windows 10 or newer. You can download its zip file from the Github Releases page.

4. Deploy and execute reports

This can be deployed over Connect or can be executed from local files.

4.1 Execute in development device

4.1.1 Configure Connect cli

Add a new account

First of all you need to add an account the connect-cli with the CloudBlue Connect API key.

    $ ccli account add "ApiKey XXXXX:YYYYY"

4.1.2 Reports management

In order tu manage reports, 'ccli report' command shoud be used:

$ ccli report

Usage: ccli report [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  execute  Execute a report.
  info     Get additional information for a given report.
  list     List available reports.

List reports

List reports uploaded to connect

    $ ccli report list

List reports into repository

    $ ccli report list -d /path/to/packages/json/cotaining/folder

Get information about a report

Get information about a report uploaded to connect

    $ ccli report info {id}

Get information about a report into repository

    $ ccli report info {id} -d /path/to/packages/json/cotaining/folder

Execute Report

Report execution will gide you through several steps, depending on how many selections must be done to filter data:

ArchImage

ArchImage

ArchImage

ArchImage

Execute reports uploaded to connect

    $ ccli report execute {id}

Execute reports into repository

    $ ccli report execute {id} -d /path/to/packages/json/cotaining/folder

4.2 Deploy in Connect

In order to add reports to Connect, you have to make a release and tag on GitHub.

4.2.1 Adding a repository

Note that this step need to be done only once.

Steps:

  • Access to Devi connect site and navigate to [Account > Reports > Repositories].
  • Press the link ADD REPOSITORY to add this repository.
  • Fill the form:
  • Press next and choose the tag
  • Complete the wizard.

4.2.2 Editing a repository

Steps:

  • Access to Devi connect site and navigate to [Account > Reports > Repositories].
  • Press the edit button (pencil icon) to edit one of the repositories of the list.
  • Complete the form as indicated in Adding a repository section.

4.2.3 Create a report

Steps:

  • Access to Devi connect site and navigate to [Reports].
  • Press the link CREATE REPORT.
  • Select one of the templates of this repository.
  • Complete the wizard specific for the selected template.

5 Reports API

This tool access to information through Connect API.

5.1 Headers

These headers must be sent

5.1.1 Authorization

Requests must have Authorization header with value:

    ApiKey XXXX:xxxxxx

5.1.2 Accept

Requests must have accept header with value application/json

5.2 Endpoint

https://apispec.connect.cloudblue.com/public/v1/requests

5.3 Pagination

Request parameters limit and offset are available in order to paginate the results:

    https://api.connect.cloudblue.com/public/v1/requests?and(ge(events.created.at,2022-11-10T23:00:00+00:00),le(events.created.at,2022-11-11T23:00:00+00:00))&ordering(created)&limit=500&offset=0

5.4 Sort

ordering request parameteris available in order to sort the results:

    https://api.connect.cloudblue.com/public/v1/requests?and(ge(events.created.at,2022-11-10T23:00:00+00:00),le(events.created.at,2022-11-11T23:00:00+00:00))&ordering(created)&limit=500&offset=0

5.5 Query

RQL language is used in order to perform queries that allows us to filter the results

i.e.

    and(ge(events.created.at,2022-11-10T23:00:00+00:00),le(events.created.at,2022-11-11T23:00:00+00:00),in(asset.product.id,(__product_id__)))

This query is sent as request param:

    https://api.connect.cloudblue.com/public/v1/requests?and(ge(events.created.at,2022-11-10T23:00:00+00:00),le(events.created.at,2022-11-11T23:00:00+00:00))&ordering(created)&limit=500&offset=0

About

Repository that has all CloudBlue Connect Reports for Devi

Resources

Stars

Watchers

Forks

Packages

No packages published