<?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: Commit file in github api using program in sas studio in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/528190#M6861</link>
    <description>&lt;P&gt;Just to add an update: there are new Git functions in Base SAS, and experimental Git integration directly in SAS Studio.&amp;nbsp; Read about these updates here: &lt;A href="https://blogs.sas.com/content/sasdummy/2019/01/17/git-in-sas/" target="_self"&gt;Using built-in Git operations in SAS&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jan 2019 22:42:13 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2019-01-17T22:42:13Z</dc:date>
    <item>
      <title>Commit file in github api using program in sas studio</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/527486#M6855</link>
      <description>&lt;P&gt;I have come across a method where we get the sha code when we hit the github url but once i have done the get request and have the tree code as well as the shacode. Once i perform the post operation i am getting 404 as the error can you help regarding this. i have achieved the same using rest api but want to do the same using sas studio program that i have created .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let user="username";
%let pass="personaltoken generated at githu";
filename eqty "/home/mystudiodirectory/test.txt" lrecl=32000;

proc http
  url="https://api.github.com/repos/user/repos/git/refs/heads/master"
  method="GET" out=eqty webusername=&amp;amp;user
  webpassword=&amp;amp;pass
  ct="application/text";
run;

data firstrequest;
  infile "/home/mystudiodirectory0/test.txt" dsd lrecl=3000000;
  input x : $2000. @@;
  retain flag;
  pos=find(x, "sha");
  if(pos&amp;gt;0) then
    do;
      flag=1;
      var=scan(x, 3, '""');
      shalatestcommit=scan(x, 5, '""');
    end;
run;

data request2(keep=shalatestcommit);
  set firstrequest;
  if var not in ('sha') then
    delete;
  call symput('shaltcommit', trim(shalatestcommit));
run;

/*******************************second request**************************/
%let url=https://api.github.com/repos/user/repository/git/commits/&amp;amp;shaltcommit.;
filename eqty1 "/home/mystudiodirectory0/test1.txt" lrecl=32000;

proc http url="&amp;amp;url" method="GET" out=eqty1 webusername=&amp;amp;user
  webpassword=&amp;amp;pass
  ct="application/text";

data secondrequest;
  infile "/home/mystudiodirectory0/test1.txt" dsd lrecl=3000000;
  input x : $2000. @@;
  retain flag1;
  pos=find(x, "tree");
  if(pos&amp;gt;0) then
    do;
      flag1=1;
      var=scan(x, 1, '""');
      treecommit=scan(x, 5, '""');
    end;
run;

data request3(keep=treecommit);
  set secondrequest;
  if var not in ('tree') then
    delete;
  call symput('treecommit', trim(treecommit));
run;

/************************************************************/
*filename eqty3 "/home/mystudiodirectory0/test3.txt";

/*data store;
y=compress(symget(&amp;amp;body));
file eqty3;
put y;
run;*/
filename eqty2 "/home/mystudiodirectory0/test2.txt" lrecl=32000;

data _null_;
  infile datalines;
  file eqty2;
  input;
  put _infile_;
  datalines;
{
"base_tree": "treecommit value",
"tree": [
{
"path": "NewFile1.txt",
"mode": "100644",
"type": "blob",
"content": "This is NewFile1."
}
]
}
;
run;

filename eqty3 "/home/mystudiodirectory0/test3.txt" lrecl=32000;
;

proc http url="https://api.github.com/repos/user/repository/git/trees"
  method="POST" in=eqty2 out=eqty3 webusername=&amp;amp;user
  webpassword=&amp;amp;pass;

data thirdrequest;
  infile "/home/mystudiodirectory0/test3.txt" dsd lrecl=3000000;
  input x : $2000. @@;
  retain flag2;
  pos=find(x, "sha");
  if(pos&amp;gt;0) then
    do;
      flag2=1;
      var=scan(x, 1, '""');
      nwshalatestcommit=scan(x, 3, '""');
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 20:42:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/527486#M6855</guid>
      <dc:creator>shreyansh241990</dc:creator>
      <dc:date>2019-01-15T20:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Commit file in github api using program in sas studio</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/527502#M6856</link>
      <description>&lt;P&gt;Before we look at anything else, I want to make you and other readers aware of this - in SAS 9.4 Maint 6, a new set of Git functions were introduced in the SAS programming language.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n1mlc3f9w9zh9fn13qswiq6hrta0.htm&amp;amp;locale=en" target="_self"&gt;Read all about them in the doc&lt;/A&gt;.&amp;nbsp; These might make your tasks easier to accomplish with less code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The 404 error is "Not Found", and usually the simplest explanation is that the API call you've made isn't valid.&amp;nbsp; Your program that you shared has placeholders for "repository" and "user" (assuming you would use your own username and a valid repository name), so check those first.&amp;nbsp; &lt;A href="https://developer.github.com/v3/git/trees/#create-a-tree" target="_self"&gt;I assume this is the API you're trying to use&lt;/A&gt;?&lt;/P&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 20:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/527502#M6856</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2019-01-15T20:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Commit file in github api using program in sas studio</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/527668#M6858</link>
      <description>Chris i am using my user and repository names but i didnt specify it here just replaced those things here and yes the link that you have shared i am using the same approach but i am getting message not found although the two get request i have done i get the tree code and if i use it in rest client it is working fine.So problem is mainly with post method.Let me know if you need more info</description>
      <pubDate>Wed, 16 Jan 2019 09:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/527668#M6858</guid>
      <dc:creator>shreyansh241990</dc:creator>
      <dc:date>2019-01-16T09:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Commit file in github api using program in sas studio</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/527680#M6859</link>
      <description>Just to add i am using sas studio as the platform</description>
      <pubDate>Wed, 16 Jan 2019 11:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/527680#M6859</guid>
      <dc:creator>shreyansh241990</dc:creator>
      <dc:date>2019-01-16T11:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Commit file in github api using program in sas studio</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/527688#M6860</link>
      <description>&lt;P&gt;The 404 error still indicates that the API, as you're calling it in SAS, doesn't exist -- maybe something is just a little bit off.&amp;nbsp; If it works in another REST client like Postman or cURL, then it should work in SAS as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest &lt;A href="https://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n0i2ek87s12e7mn1h2q3h0mywkl1.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;adding the DEBUG statement to your PROC HTTP call&lt;/A&gt; and maybe you'll get more information about what you're sending/receiving.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 12:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/527688#M6860</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2019-01-16T12:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Commit file in github api using program in sas studio</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/528190#M6861</link>
      <description>&lt;P&gt;Just to add an update: there are new Git functions in Base SAS, and experimental Git integration directly in SAS Studio.&amp;nbsp; Read about these updates here: &lt;A href="https://blogs.sas.com/content/sasdummy/2019/01/17/git-in-sas/" target="_self"&gt;Using built-in Git operations in SAS&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 22:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Commit-file-in-github-api-using-program-in-sas-studio/m-p/528190#M6861</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2019-01-17T22:42:13Z</dc:date>
    </item>
  </channel>
</rss>

