cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

String API to Number API conversion error for blank values

I have a flow that takes (using GET) data from one API in a string format (even though they are all numbers), and I need to POST it to another API in a number format... I am using the HTTP connector for this.

 

To convert the string, in the body of the POST request I am simply using 'float'. My problem is that sometimes the string values from the GET are blank... I am trying to get the value to be blank in the POST payload, but I can only get it to display as "".

 

I'm using the following in the body:

 

  "RP341531.RPSYSFEDCL001A": [

    {

      "timestamp": @{variables('timestamp')},

      "value": @{if(empty(items('Apply_to_each_2')?['post_gac_cl2_ppm_']),’’,float(items('Apply_to_each_2')?['post_gac_cl2_ppm_']))}

    }

 

The resulting payload for the blank values comes out as "value": ""   (the code starting IX.... is the mapping for the parameter)

,
  "IX250651.IXDAYPRDSL001A": [
    {
      "timestamp""2020-04-28 10:56:00",
      "value": ""
    }
  ]
}

 

Error response for the POST from the API:

{
  "detail""'' is not of type 'number'",
  "status"400,
  "title""Bad Request",
  "type""about:blank"
}
 
For it to work, I think I need to to display
 
  "IX250651.IXDAYPRDSL001A": [
    {
      "timestamp""2020-04-28 10:56:00",
      "value"
    }
  ]
}
 
Any help is much apprciated!
1 REPLY 1
Regular Visitor

For more information: 

This is the first http to get the informationThis is the first http to get the informationthis is where I am posting the information tothis is where I am posting the information to

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (2,908)