Forum Discussion

zayne's avatar
zayne
Frequent Visitor
3 years ago
Solved

how to structure complex Web.Content Query parameters

Hi all

 

I'm trying to format my API call from this:

 

Source = Json.Document(Web.Contents("https://portal.example.com/api/v1/search/domains?query=example.com&relationships[]=account&relationships[]=account.partner"

 

to use RelativePath and Query parameters:

 

 

    Source = Json.Document(
        Web.Contents(
            BaseURL,
                [
                    RelativePath = Entity,
                    Query = [
                                query = Domain,
                                relationships = ???????
                            ],
                    Headers = [
                                Authorization = APIKey
                            ]
            ]
        )
    ),

 

 

The issue I'm having is that I don't know how to structure the "relationships[]=" part into the proper format. The format that the call returns (when using the first format shown above) is this:

 

 

[
    {
        "uuid": "b1acfa92-2e62-4e95-9b4e-6f2e2ad30fec",
        "suid": "8wecg43a",
        "token": "fg;hdjghlwtb9sdfgghgsdlgjsdgijsdhg",
        "domain_name": "example.com",
        "type": "configured",
        "enable_dkim_public_keys": false,
        "dkim_public_key_name_servers": [],
        "dkim_policy_settings": {
            "o": "~",
            "t": "y"
        },
        "enable_bimi": false,
        "bimi_name_servers": [],
        "is_favourite": false,
        "created_at": "2022-06-13T21:25:23.000000Z",
        "updated_at": "2022-06-27T07:48:03.000000Z",
        "path": "/domains/b1acfa92-2e62-4e95-9b4e-6f2e2ad30fec",
        "is_dmarc_setup_verified": false,
        "account": {
            "uuid": "61d0d8c8-4061-49cc-b194-a470e6a29fba",
            "name": "Example Account",
            "email": "[email protected]",
            "level": "account",
            "type_backup": "basic plus",
            "status": "active",
            "sso_status": "enabled",
            "sso_provider": null,
            "two_factor_status": "enabled",
            "billing_reference": null,
            "billing_period": "monthly",
            "billing_period_expires_at": null,
            "poc_set_at": null,
            "created_at": "2022-06-13T13:26:47.000000Z",
            "updated_at": "2022-08-08T12:35:13.000000Z",
            "country_code": null,
            "technical_contact_name": null,
            "technical_contact_email": null,
            "technical_contact_phone": null,
            "path": "/accounts/61d0d8c8-4061-49cc-b194-a470e6a29fba",
            "type": "basic plus",
            "package_name": "basic plus",
            "users_path": "/accounts/61d0d8c8-4061-49cc-b194-a470e6a29fba/users",
            "domains_path": "/accounts/61d0d8c8-4061-49cc-b194-a470e6a29fba/domains",
            "partner": {
                "uuid": "a432508b-0dd3-46af-b4ef-fae217431fbb",
                "name": "Example Partner",
                "email": "[email protected]",
                "support_email": null,
                "support_url": null,
                "enable_partner_branding": false,
                "partner_branding_logo": null,
                "partner_branding_background_colour": null,
                "created_at": "2022-06-13T13:26:47.000000Z",
                "updated_at": "2022-06-13T13:26:47.000000Z",
                "deleted_at": null
            },
            "package": {
                "uuid": "decce53e-ccc1-4177-8119-7d9f0d0c1265",
                "name": "basic plus",
                "created_at": null,
                "updated_at": null
            }
        },
        "spf_settings": {
            "directives": [],
            "modifiers": [],
            "all_mechanism_qualifier": "-",
            "enable_optimization": false,
            "optimization_level": "none",
            "optimization_expires_at": null,
            "created_at": "2022-06-13T21:25:24.000000Z",
            "updated_at": "2022-06-13T21:25:24.000000Z",
            "path": "/domains/b1acfa92-2e62-4e95-9b4e-6f2e2ad30fec/spf-settings"
        },
        "dmarc_settings": {
            "policy": "none",
            "subdomain_policy": "none",
            "policy_percentage": 100,
            "aggregate_report_recipient_emails": [],
            "aggregate_report_interval": 86400,
            "forensic_report_processing": "disabled",
            "forensic_report_recipient_emails": [],
            "forensic_report_options": "1",
            "forensic_report_format": "afrf",
            "dkim_alignment": "r",
            "spf_alignment": "r",
            "created_at": "2022-06-13T21:25:24.000000Z",
            "updated_at": "2022-06-13T21:25:24.000000Z",
            "path": "/domains/b1acfa92-2e62-4e95-9b4e-6f2e2ad30fec/dmarc-settings"
        }
    }
]

 

 

The reason I'm trying to convert it is that I'm making this a part of a dataflow, but it won't save if I use the first format, as it says it's a dynamic query. 

Would appreciate any help on this.

  • zayne's avatar
    zayne
    3 years ago

    It turns out I just had to structure the Query like this:

     

                        Query = [
                                    ..........
                                    #"relationships[]" = {"account", "account.partner"}
                              
                                ],

3 Replies