web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / JSON trouble. content ...
Power Automate
Answered

JSON trouble. content length is Zero.

(0) ShareShare
ReportReport
Posted on by

Hi there, 

 

I am using a flow to gather in put from wordpress via a gravity form. 

My flow starts with a HTTP request  then sends an email the email should contain the data from the json. 

( this is not the final aim of the flow but a good way to test that the data is coming through correctly ) 

 

I post my data from a PHP function with in the functions.php of my word press theme. 

My flow is activated correctly. I get the email BUT there is no content.  

my Json seems to parse correctly but when I test it the content lenght says zero?

 

I have checked to see that there is data in the array prior to the JSON being sent to the flow. 

here are some images that may hep expalin what is happening. 

 

 

 

 

SHowing that the parse seems to happen correctly l, the correct keys are displayed.SHowing that the parse seems to happen correctly l, the correct keys are displayed.content length = 0content length = 0

 

thank you for your help!

 

 

Categories:
I have the same question (0)
  • v-zhos-msft Profile Picture
    on at

    Hi @Anonymous ,

    Could you please share a full screenshot of the Schema in the INPUTS ?

    Please make sure the "name" field has value.

    Capture7.PNG

    Best Regards,

    Community Support Team _ Zhongys

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Community Power Platform Member Profile Picture
    on at

    hi @v-zhos-msft   Thanks for your quic response. 

     

    here is what I am sending from my wordpress funcitons file and headers looks like this. 

     

    $header = array('Content-Type' => 'application/json; charset=utf-8');
    $response = $request->post( $post_url, array('headers'=>$header), array('body' => $body ) );

     and body is sent like this... 

     

    $body = array(
    'name' => "jennie",//$namef." ".$names,
    'email' => rgar( $entry, '3' ),
    'phone' => rgar( $entry, '4' ),
    'book_inspection' =>rgar($entry,'6'),
    'message'=>rgar($entry,'16'),
    'property_to_inspect_line1' => rgar($entry,'2.1'),
    'property_to_inspect_line2' => rgar($entry,'2.2'),
    'property_to_inspect_city' => rgar($entry,'2.3'),
    'property_to_inspect_region' => rgar($entry,'2.4'),
    'property_to_inspect_postal_code' => rgar($entry,'2.5'),
    'property_to_inspect_age'=>rgar($entry,'10'),
    "property_to_inspect_size"=>rgar($entry, '11'),
    "property_to_inspect_levels"=>rgar($entry,'12'),
    "property_to_inspect_os_contact"=>rgar($entry, '13'),
    "property_to_inspect_os_phone" =>rgar($entry,'14'),
    "real_estate_agent_name" => rgar( $entry, '18.3' )." ".rgar( $entry, '18.6' ),
    "real_estate_phone" =>rgar($entry,'19'),
    "real_estate_company" =>rgar($entry,'21')
    );

     

     

    As you can see I have hard coded the name  in so that it definetly has a value. 

    my JSON in the HTTP requested recived trigger.

     

    is like this... 

    {
     "properties": {
     "name": {
     "type": "string"
     },
     "email": {
     "type": "string"
     },
     "phone": {
     "type": "string"
     },
     "book_inspection": {
     "type": "string"
     },
     "message": {
     "type": "string"
     },
     "property_to_inspect_line1": {
     "type": "string"
     },
     "property_to_inspect_line2": {
     "type": "string"
     },
     "property_to_inspect_city": {
     "type": "string"
     },
     "property_to_inspect_region": {
     "type": "string"
     },
     "property_to_inspect_postal_code": {
     "type": "string"
     },
     "property_to_inspect_age": {
     "type": "string"
     },
     "property_to_inspect_size": {
     "type": "string"
     },
     "property_to_inspect_levels": {
     "type": "string"
     },
     "property_to_inspect_os_contact": {
     "type": "string"
     },
     "property_to_inspect_os_phone": {
     "type": "string"
     },
     "real_estate_agent_name": {
     "type": "string"
     },
     "real_estate_phone": {
     "type": "string"
     },
     "real_estate_company": {
     "type": "string"
     }
     },
     "type": "object"
    }

    Do I have to define the content type in that section ? 

    This is the response i recive back code side 

     

    Date: Tue, 09 Apr 2019 08:11:57 GMT
    Connection: close
    Content-Length: 0
    
    
     [headers] => Requests_Response_Headers Object
     (
     [data:protected] => Array
     (
     [cache-control] => Array
     (
     [0] => no-cache
     )
    
     [pragma] => Array
     (
     [0] => no-cache
     )
    
     [expires] => Array
     (
     [0] => -1
     )
    
     [x-ms-workflow-run-id] => Array
     (
     [0] => 08586468093676538428062757441CU22
     )
    
     [x-ms-correlation-id] => Array
     (
     [0] => 68ff4fd1-4baf-499b-b3b7-22e4e8434d95
     )
    
     [x-ms-client-tracking-id] => Array
     (
     [0] => 08586468093676538428062757441CU22
     )
    
     [x-ms-trigger-history-name] => Array
     (
     [0] => 08586468093676538428062757441CU22
     )
    
     [x-ms-execution-location] => Array
     (
     [0] => australiasoutheast
     )
    
     [x-ms-workflow-id] => Array
     (
     [0] => 90ff416da39c4aa4b859ecad0b266db7
     )
    
     [x-ms-workflow-version] => Array
     (
     [0] => 08586468945967043701
     )
    
     [x-ms-workflow-name] => Array
     (
     [0] => abc54c02-b498-4a44-a22e-d5105da6e3db
     )
    
     [x-ms-workflow-system-id] => Array
     (
     [0] => /locations/australiasoutheast/scaleunits/prod-28/workflows/90ff416da39c4aa4b859ecad0b266db7
     )
    
     [x-ms-tracking-id] => Array
     (
     [0] => 68ff4fd1-4baf-499b-b3b7-22e4e8434d95
     )
    
     [x-ms-ratelimit-burst-remaining-workflow-writes] => Array
     (
     [0] => 14999
     )
    
     [x-ms-ratelimit-remaining-workflow-download-contentsize] => Array
     (
     [0] => 1073741824
     )
    
     [x-ms-ratelimit-time-remaining-directapirequests] => Array
     (
     [0] => 99999926
     )
    
     [x-ms-request-id] => Array
     (
     [0] => australiasoutheast:68ff4fd1-4baf-499b-b3b7-22e4e8434d95
     )
    
     [strict-transport-security] => Array
     (
     [0] => max-age=31536000; includeSubDomains
     )
    
     [date] => Array
     (
     [0] => Tue, 09 Apr 2019 08:11:57 GMT
     )
    
     [content-length] => Array
     (
     [0] => 0
     )
    
     )
    
     )
    
     [status_code] => 202
     [protocol_version] => 1.1
     [success] => 1
     [redirects] => 0
     [url] => https://prod-28.australiasoutheast.logic.azure.com/workflows/90ff416da39c4aa4b859ecad0b266db7/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_e61GyvR5SWl44w3FyhmZAKI_RunRfchsD4frhidn4k
     [history] => Array
     (
     )
    
     [cookies] => Requests_Cookie_Jar Object
     (
     [cookies:protected] => Array
     (
     )
    
     )
    
     )
    
     [filename:protected] => 
     [data] => 
     [headers] => 
     [status] => 
     )
    
    )
     

    I am thinking that the problem lays in the way that I am passing the header content type? 

    would love some help figuring it out though! 

     

    Thank you for your time. 

     

    Jennie. 

  • Community Power Platform Member Profile Picture
    on at

    Ah so prehaps it is indeed my JSON encode. 

    I have now added this.. 

    $response = $request->post($post_url, ['headers' => ['Accept' => 'application/json', 'Content-Type' => 'application/json'], 'body' => wp_json_encode($body)]);

     

    {"name":"jennie","email":"jennie@matadigital.nz","phone":"(111) 111-1111","book_inspection":"Yes","message":"wertdfgdfgdgds","property_to_inspect_line1":"athe street","property_to_inspect_line2":"","property_to_inspect_city":"","property_to_inspect_region":"","property_to_inspect_postal_code":"","property_to_inspect_age":"s","property_to_inspect_size":"df","property_to_inspect_levels":"fgs","property_to_inspect_os_contact":"sfd","property_to_inspect_os_phone":"sf","real_estate_agent_name":"jennie@matadigital.nz kristopherson","real_estate_phone":"(011) 645-9743","real_estate_company":"estateAgent@company.com"} 
    
    
    
    

    I stil need some guidence in what I should be setting in the header?

    cheers

     

    Jennie.

  • v-zhos-msft Profile Picture
    on at

    Hi @Anonymous ,

    Thanks for your feedback.

    I can't figure out where is the problem currently, I will do more research on this issue.

    Thank you for your patience.

    Best Regards,

    Zhongys

     

  • Community Power Platform Member Profile Picture
    on at

    I got it! 

     

    So my body ( the JSON schema ) produced in the PHP was not matching, even though it appeared too.

    It had the object tag at the bottom instead of the top, I used the payload to generate the scheme button, and it then worked. Thank you for taking the time to help, expaining my problem really helped me find the issue. 

     

     

  • v-zhos-msft Profile Picture
    on at

    Hi @Anonymous ,

    So you have solved the problem, right?

    Congratulates about that.

    Best Regards,

    Community Support Team _ Zhongys

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    Yes SOLVED.

     

    so if any one else is encourntering a similar problem:

     

    Check you are doing your header correctly. 

    and  generate your JSON payload then use the genertae schema button on the flow component.

     

    Then there should be no troubles! 

     

    Cheers

    Jennie. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard