The "Type" parameter

Create custom functionality with the 'type' parameter.

The Type url parameter (?type=) can be used to overwrite the data export type. Below are examples of how it can be used to format your data.

Example Export URL

https://api.csvgetter.com/CBIfM4nqnrj9WHqxOm3W

Output (CSV)

Name,Age,Gender,Occupation
John Doe,35,Male,Engineer
Jane Smith,28,Female,Doctor

JSON Records

?type=json_records (if first parameter)

&type=json_records (if not first parameter)

What does it do?

Overwrite the data export type as data records.

Example

https://api.csvgetter.com/CBIfM4nqnrj9WHqxOm3W?type=json_records

[
    {
        "Name": "John Doe",
        "Age": 35,
        "Gender": "Male",
        "Occupation": "Engineer"
    },
    {
        "Name": "Jane Smith",
        "Age": 28,
        "Gender": "Female",
        "Occupation": "Doctor"
    }
]

JSON Index

?type=json_index (if first parameter) &type=json_index (if not first parameter)

What does it do?

Overwrites the data export type as indexed JSON data

Example

https://api.csvgetter.com/CBIfM4nqnrj9WHqxOm3W?type=json_index

{
    "0": {
        "Name": "John Doe",
        "Age": 35,
        "Gender": "Male",
        "Occupation": "Engineer"
    },
    "1": {
        "Name": "Jane Smith",
        "Age": 28,
        "Gender": "Female",
        "Occupation": "Doctor"
    }
}

JSON Split

?type=json_split (if first parameter) &type=json_split (if not first parameter)

What does it do?

Overwrites the data export type as indexed JSON data

Example

https://api.csvgetter.com/CBIfM4nqnrj9WHqxOm3W?type=json_split

{
    "columns": [
        "Name",
        "Age",
        "Gender",
        "Occupation"
    ],
    "index": [
        0,
        1
    ],
    "data": [
        [
            "John Doe",
            35,
            "Male",
            "Engineer"
        ],
        [
            "Jane Smith",
            28,
            "Female",
            "Doctor"
        ]
    ]
}

JSON Columns

?type=json_columns (if first parameter) &type=json_columns (if not first parameter)

What does it do?

Overwrites the data export type as JSON column data.

Example

https://api.csvgetter.com/CBIfM4nqnrj9WHqxOm3W?type=json_columns

{
    "Name": {
        "0": "John Doe",
        "1": "Jane Smith"
    },
    "Age": {
        "0": 35,
        "1": 28
    },
    "Gender": {
        "0": "Male",
        "1": "Female"
    },
    "Occupation": {
        "0": "Engineer",
        "1": "Doctor"
    }
}

JSON Table

?type=json_table (if first parameter) &type=json_table (if not first parameter)

What does it do?

Overwrites the data export type as JSON table data.

Example

https://api.csvgetter.com/CBIfM4nqnrj9WHqxOm3W?type=json_table

{
    "schema": {
        "fields": [
            {
                "name": "index",
                "type": "integer"
            },
            {
                "name": "Name",
                "type": "string"
            },
            {
                "name": "Age",
                "type": "integer"
            },
            {
                "name": "Gender",
                "type": "string"
            },
            {
                "name": "Occupation",
                "type": "string"
            }
        ],
        "primaryKey": [
            "index"
        ],
        "pandas_version": "1.4.0"
    },
    "data": [
        {
            "index": 0,
            "Name": "John Doe",
            "Age": 35,
            "Gender": "Male",
            "Occupation": "Engineer"
        },
        {
            "index": 1,
            "Name": "Jane Smith",
            "Age": 28,
            "Gender": "Female",
            "Occupation": "Doctor"
        }
    ]
}

XML

?type=xml (if first parameter) &type=xml (if not first parameter)

What does it do?

Overwrites the data export type as XML feed

Example

https://api.csvgetter.com/CBIfM4nqnrj9WHqxOm3W?type=xml

<?xml version='1.0' encoding='utf-8'?>
<data>
    <row>
        <Name>John Doe</Name>
        <Age>35</Age>
        <Gender>Male</Gender>
        <Occupation>Engineer</Occupation>
    </row>
    <row>
        <Name>Jane Smith</Name>
        <Age>28</Age>
        <Gender>Female</Gender>
        <Occupation>Doctor</Occupation>
    </row>
</data>

Excel Web Query

?type=excel_web_query (if first parameter) &type=excel_web_query (if not first parameter)

What does it do?

Returns data as html table suitable for web queries, particularly the power query required for excel mac. Example here.

Example

https://api.csvgetter.com/CBIfM4nqnrj9WHqxOm3W?type=excel_web_query

HTML Table

?type=html_table (if first parameter) &type=html_table (if not first parameter)

What does it do?

Shows the data as an HTML table. Same result as excel_web_query.

Example

https://api.csvgetter.com/CBIfM4nqnrj9WHqxOm3W?type=html_table

Dynamic HTML Table

?type=dynamic_table (if first parameter) &type=dynamic_table (if not first parameter)

What does it do?

Shows the data as a sortable and searchable HTML table with pagination.

Example

https://api.csvgetter.com/CBIfM4nqnrj9WHqxOm3W?type=dynamic_table

Last updated