<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PROC HTTP -  get an response  HTTP/1.1 411 Length Required in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-HTTP-get-an-response-HTTP-1-1-411-Length-Required/m-p/664702#M198621</link>
    <description>&lt;P&gt;I Googled "HTTP Error 411. The request must be chunked or have a content length", and the results suggests&lt;/P&gt;
&lt;P&gt;adding&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;"Content-Length" = "0"&lt;/STRONG&gt; to your &lt;A href="https://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p13ivsak251kuvn1grpv60dc18yb.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;headers statement&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ahmed&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jun 2020 16:38:18 GMT</pubDate>
    <dc:creator>AhmedAl_Attar</dc:creator>
    <dc:date>2020-06-24T16:38:18Z</dc:date>
    <item>
      <title>PROC HTTP -  get an response  HTTP/1.1 411 Length Required</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-HTTP-get-an-response-HTTP-1-1-411-Length-Required/m-p/664674#M198607</link>
      <description>&lt;P&gt;I am using SAS EG ( SAS 9.4.5.0 ) to connect to an REST API using PROC HTTP:&lt;/P&gt;&lt;P&gt;It is token based.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get an &lt;EM&gt;&lt;STRONG&gt;"&amp;lt; HTTP/1.1 411 Length Require&lt;/STRONG&gt;&lt;STRONG&gt;d&lt;/STRONG&gt;&lt;/EM&gt;"&amp;nbsp; error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question&lt;/STRONG&gt;: &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Is there something else I have to specify to avoid this error?&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;First step&lt;/STRONG&gt;: to get a token works&amp;nbsp; fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Step two&lt;/STRONG&gt; is a POST where I send a JSON GRAPGQL request together with the token and some extra parameters&lt;/P&gt;&lt;P&gt;( I do the same query in &lt;STRONG&gt;POSTMAN&lt;/STRONG&gt; and it works fine)&lt;/P&gt;&lt;P&gt;I feed the Token from a file due to the size(&amp;gt;1000 char)&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feed the GraphQL from a file as well&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SAS CODE :&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC HTTP 
   url="https://apis.collabor8.no/stable/graph" 
   method="POST"
   ct="application/json"
   OAUTH_BEARER=token
   out=proddata
   in=query;
   headers 
	 "Ocp-Apim-Subscription-Key" = "&amp;amp;opcSubscriptionKey"
 ; 
    DEBUG LEVEL=3 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;The HTTP input looks like this:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; POST /stable/graph HTTP/1.1&lt;BR /&gt;&amp;gt; User-Agent: SAS/9&lt;BR /&gt;&amp;gt; Host: apis.collabor8.no&lt;BR /&gt;&amp;gt; Accept: */*&lt;BR /&gt;&amp;gt; Authorization: Bearer&lt;BR /&gt;eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlNzWnNCTmhaY0YzUTlTNHRycFFCVEJ5TlJSSSIsImtpZCI6IlNzWnNCTmhaY0YzUT...&lt;FONT color="#FF0000"&gt;&lt;EM&gt; removed the rest of the token... due to the size&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&amp;gt;&lt;BR /&gt;&amp;gt; Connection: Keep-Alive&lt;BR /&gt;&amp;gt; Content-Length: 618&lt;BR /&gt;&amp;gt; Cookie:&lt;BR /&gt;ReportingHubAPI=CfDJ8AAt85rvf4dOl01UicW-Bp7Td9gZ9f6LhwHnGt73vIcSJwv3JmNugnkR41JMV313Sz-M4nCB5ctuz2d4bq6p_C_E6ZvCx8BZYeMv4zJ0wnmSBjwB&lt;BR /&gt;q3HFe6UjM..&lt;EM&gt;.. &lt;FONT color="#FF0000"&gt;removed the rest due to the size...&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;2 The SAS System 14:33 Tuesday, June 23, 2020&lt;/P&gt;&lt;P&gt;&amp;gt; Ocp-Apim-Subscription-Key: 322286a3a2f74c15ac3ec6a3c38cac3f&lt;BR /&gt;&amp;gt; Content-Type: application/json&lt;BR /&gt;&amp;gt;&lt;BR /&gt;query { production { data( start: "2020-06-13" end: "2020-06-19" report_data_subtypes: ["Production"]&lt;BR /&gt;entity_names_rx: ["/VISUND/i"] limit: 1000 ) { sourceStartTime sourceEndTime dataStartTime&lt;BR /&gt;dataEndTime sourceEntity { name type } owningEntity { name type&lt;BR /&gt;} dataEntity { name type } dataPeriod name type product&lt;BR /&gt;productName qualifier volume { uom value } } }}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The HTTP respons is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;lt; HTTP/1.1 411 Length Required&lt;BR /&gt;&amp;lt; Content-Type: text/html; charset=us-ascii&lt;BR /&gt;&amp;lt; Date: Wed, 24 Jun 2020 15:19:51 GMT&lt;BR /&gt;&amp;lt; Connection: close&lt;BR /&gt;&amp;lt; Content-Length: 344&lt;BR /&gt;&amp;lt;&lt;BR /&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""&lt;A href="https://communities.sas.com/" target="_blank"&gt;http://www.w3.org/TR/html4/strict.dtd"&amp;gt;&amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;&amp;lt;TITLE&amp;gt;Length&lt;/A&gt;&lt;BR /&gt;Required&amp;lt;/TITLE&amp;gt;&amp;lt;META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"&amp;gt;&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;&amp;lt;h2&amp;gt;Length&lt;BR /&gt;Required&amp;lt;/h2&amp;gt;&amp;lt;hr&amp;gt;&amp;lt;p&amp;gt;HTTP Error 411. The request must be chunked or have a content length.&amp;lt;/p&amp;gt;&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 15:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-HTTP-get-an-response-HTTP-1-1-411-Length-Required/m-p/664674#M198607</guid>
      <dc:creator>lillejordh</dc:creator>
      <dc:date>2020-06-24T15:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC HTTP -  get an response  HTTP/1.1 411 Length Required</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-HTTP-get-an-response-HTTP-1-1-411-Length-Required/m-p/664702#M198621</link>
      <description>&lt;P&gt;I Googled "HTTP Error 411. The request must be chunked or have a content length", and the results suggests&lt;/P&gt;
&lt;P&gt;adding&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;"Content-Length" = "0"&lt;/STRONG&gt; to your &lt;A href="https://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p13ivsak251kuvn1grpv60dc18yb.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;headers statement&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ahmed&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 16:38:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-HTTP-get-an-response-HTTP-1-1-411-Length-Required/m-p/664702#M198621</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2020-06-24T16:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC HTTP -  get an response  HTTP/1.1 411 Length Required</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-HTTP-get-an-response-HTTP-1-1-411-Length-Required/m-p/665315#M198908</link>
      <description>&lt;P&gt;Thanks for your repsonse.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I updated my code to include "&lt;FONT color="#FF0000"&gt;Content-Length=0&lt;/FONT&gt;" in the headers - but still I get the same error.&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;Required&amp;lt;/TITLE&amp;gt;&amp;lt;META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"&amp;gt;&amp;lt;/HEAD&amp;gt;&amp;lt;BODY&amp;gt;&amp;lt;h2&amp;gt;Length &lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;EM&gt;Required&amp;lt;/h2&amp;gt;&amp;lt;hr&amp;gt;&amp;lt;p&amp;gt;HTTP Error 411. The request must be chunked or have a content length.&amp;lt;/p&amp;gt;&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I do not&amp;nbsp; include the :&amp;nbsp;"&lt;FONT color="#FF0000"&gt;Content-Length=0&lt;/FONT&gt;" SAS sends the length ( e,g.&amp;nbsp;Content-Length: 618 )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS code with added Conent-Length&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC HTTP 
   url="https://apis.collabor8.no/stable/graph" 
   method="POST"
   ct="application/json"
   OAUTH_BEARER=token
   out=proddata
   in=query;
     *VERBOSE ;  
   headers 
   	 "Content-Length" = "0"
	 "Ocp-Apim-Subscription-Key" = "&amp;amp;opcSubscriptionKey"
	 ; 
    DEBUG LEVEL=3 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2020 11:51:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-HTTP-get-an-response-HTTP-1-1-411-Length-Required/m-p/665315#M198908</guid>
      <dc:creator>lillejordh</dc:creator>
      <dc:date>2020-06-26T11:51:06Z</dc:date>
    </item>
  </channel>
</rss>

