cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

CUSTOM CONNECTOR: Help with JSON Request (or Response?)

Man! Custom Connectors can get confusing to implement. I'm wrapped around the wheel and could use your input. 

Custom Connector Specifics:

Method: POST

Request:

 

{
  "geocode": {
    "lon": -76.1760973855,
    "lat": 43.302601891152
  },
  "location_id": "",
  "start_time": "2018-07-01T12:00:00Z",
  "end_time": "2018-07-01T18:00:00Z",
  "timestep": 60,
  "fields": [
  	
    {
        "name": "temp",
        "units": "C"
        },
        {
        "name": "feels_like",
        "units": "C"
        },
        {
        "name": "dewpoint",
        "units": "C"
        },
        {
        "name": "wind_speed",
        "units": "m/s"
        },
        {
        "name": "wind_gust",
        "units": "m/s"
        },
        {
        "name": "baro_pressure",
        "units": "kPa"
        },
        {
        "name": "visibility",
        "units": "km"
        },
        {
        "name": "precipitation",
        "units": "mm/hr"
        },
        {
        "name": "cloud_cover",
        "units": "%"
        },
        {
        "name": "cloud_ceiling",
        "units": "m"
        },
        {
        "name": "cloud_base",
        "units": "m"
        },
        {
        "name": "humidity",
        "units": "%"
        },
        {
        "name": "wind_direction",
        "units": "degrees"
        },
        {
        "name": "precipitation_type"
        },
        {
        "name": "sunrise"
        },
        {
        "name": "sunset"
        }
  ]
}

Response:

[
    {
        "lat": 42.30260171891152,
        "lon": -71.17609710203855,
        "temp": {
            "value": 25.56,
            "units": "C"
        },
        "feels_like": {
            "value": 25.56,
            "units": "C"
        },
        "dewpoint": {
            "value": 20.13,
            "units": "C"
        },
        "wind_speed": {
            "value": 0.45,
            "units": "m/s"
        },
        "wind_gust": {
            "value": 2.23,
            "units": "m/s"
        },
        "baro_pressure": {
            "value": 101.384,
            "units": "kPa"
        },
        "visibility": {
            "value": null,
            "units": "km"
        },
        "precipitation": {
            "value": 0,
            "units": "mm/hr"
        },
        "cloud_cover": {
            "value": null,
            "units": "%"
        },
        "cloud_ceiling": {
            "value": null,
            "units": "m"
        },
        "cloud_base": {
            "value": null,
            "units": "m"
        },
        "humidity": {
            "value": 72,
            "units": "%"
        },
        "wind_direction": {
            "value": 275,
            "units": "degrees"
        },
        "precipitation_type": {
            "value": "none"
        },
        "sunrise": {
            "value": "2018-07-01T09:11:52.000Z"
        },
        "sunset": {
            "value": "2018-07-02T00:25:08.000Z"
        },
        "observation_time": {
            "value": "2018-07-01T12:00:00.000Z"
        }
    }
]

All headers are in place and the Test results look great.

 

The Problem:

When trying to use the Custom Connector in my app:

 

ClearCollect(
    colWeather,
    APIRequest.WeatherApi(
        {
            apikey:"my-key-is-redacted",
            accept:"application/json",
            'Content-Type':"application/json",
            geocode:
                {
                    lon: Value(longitude_input.Text),
                    lat: Value(latitude_input.Text)
                },
            location_id: " ",
            start_time: DateTimeValue(startTime_zulu.Text),
            end_time:  DateTimeValue(endTime_zulu.Text), 
            timestep:60,
            fields:
                [
                    {
                        name: temp, units: F
                    }
                ]
        }
    )
)

I cannot get the fields parameter to be accepted! I've tried every JSON Table syntax possible including:

 

  • [{name: temp, units: F}]
  • {[{name:temp, units:F}]}
  • [{"name":temp, "units":F}]
  • [{"name":"temp","units":"F"}]
  • etc.

Leaving the fields table out of the request brings back all results but in Metric units. To get Imperial, I need to specify each field name and unit type.

The errors I'm receiving include:

"Missing column. Your formula is missing a column 'name' with type "Text".
"Invalid argument type. Expecting a table value, but of a different schema."

 

There are NO OTHER errors in the query except the fields portion. 

2018-10-17_23-43-43.png2018-10-17_23-48-23.png

 

Can anyone spot what I'm missing?

 

Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Mike8
Level 10

Re: CUSTOM CONNECTOR: Help with JSON Request (or Response?)

Hello,

Can you try instead of [{name: "temp", units: "F"}] --> Table({name: "temp", units: "F"})

View solution in original post

2 REPLIES 2
Mike8
Level 10

Re: CUSTOM CONNECTOR: Help with JSON Request (or Response?)

Hello,

Can you try instead of [{name: "temp", units: "F"}] --> Table({name: "temp", units: "F"})

View solution in original post

Super User
Super User

Re: CUSTOM CONNECTOR: Help with JSON Request (or Response?)

@Mike8

This is why I love the PowerApps community! Your solution worked great. 

 

Thank you very much 🙂

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,738)