<?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 How to use Ticket for getting response from the api in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-use-ticket-for-getting-response-from-the-api/m-p/120825#M33171</link>
    <description>&lt;P&gt;I have a python code and using that python code i wanted to access:&amp;nbsp;&lt;STRONG&gt;&lt;A href="http://127.0.0.1:8080/alfresco/service/api/workflow-instances/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://127.0.0.1:8080/alfresco/service/api/workflow-instances/&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I am following one link&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;A href="https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-auth-with-repo.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-auth-with-repo.html&lt;/A&gt; &lt;/STRONG&gt;&lt;/FONT&gt;where its&amp;nbsp;mentioned that you need a ticket after that encode that ticket and use it to get the access.&lt;/P&gt;&lt;P&gt;Using the above link i am able to get Ticket and have encoded it but how i can use the ticket so that i can access that link using my python code.&lt;/P&gt;&lt;P&gt;Actually the url will give a json response and my requirement is to copy that json response and save it to my local system.&lt;/P&gt;&lt;P&gt;But while accessing the url&amp;nbsp;&lt;STRONG&gt;&lt;A href="http://127.0.0.1:8080/alfresco/service/api/workflow-instances/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://127.0.0.1:8080/alfresco/service/api/workflow-instances/&lt;/A&gt; &lt;/STRONG&gt;its giving 4&lt;STRONG&gt;01 Client Error: Unauthorized for url: &lt;A href="http://127.0.0.1:8080/alfresco/service/api/workflow-instances/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://127.0.0.1:8080/alfresco/service/api/workflow-instances/&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now i have the&amp;nbsp; ticket so what changes i should do in the url or using the ticket so that i can get access to that page and save the json content .&lt;/P&gt;&lt;P&gt;Any kind of help will be appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Feb 2021 04:29:37 GMT</pubDate>
    <dc:creator>akash251998</dc:creator>
    <dc:date>2021-02-17T04:29:37Z</dc:date>
    <item>
      <title>How to use Ticket for getting response from the api</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-use-ticket-for-getting-response-from-the-api/m-p/120825#M33171</link>
      <description>&lt;P&gt;I have a python code and using that python code i wanted to access:&amp;nbsp;&lt;STRONG&gt;&lt;A href="http://127.0.0.1:8080/alfresco/service/api/workflow-instances/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://127.0.0.1:8080/alfresco/service/api/workflow-instances/&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I am following one link&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;A href="https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-auth-with-repo.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-auth-with-repo.html&lt;/A&gt; &lt;/STRONG&gt;&lt;/FONT&gt;where its&amp;nbsp;mentioned that you need a ticket after that encode that ticket and use it to get the access.&lt;/P&gt;&lt;P&gt;Using the above link i am able to get Ticket and have encoded it but how i can use the ticket so that i can access that link using my python code.&lt;/P&gt;&lt;P&gt;Actually the url will give a json response and my requirement is to copy that json response and save it to my local system.&lt;/P&gt;&lt;P&gt;But while accessing the url&amp;nbsp;&lt;STRONG&gt;&lt;A href="http://127.0.0.1:8080/alfresco/service/api/workflow-instances/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://127.0.0.1:8080/alfresco/service/api/workflow-instances/&lt;/A&gt; &lt;/STRONG&gt;its giving 4&lt;STRONG&gt;01 Client Error: Unauthorized for url: &lt;A href="http://127.0.0.1:8080/alfresco/service/api/workflow-instances/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://127.0.0.1:8080/alfresco/service/api/workflow-instances/&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now i have the&amp;nbsp; ticket so what changes i should do in the url or using the ticket so that i can get access to that page and save the json content .&lt;/P&gt;&lt;P&gt;Any kind of help will be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 04:29:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-use-ticket-for-getting-response-from-the-api/m-p/120825#M33171</guid>
      <dc:creator>akash251998</dc:creator>
      <dc:date>2021-02-17T04:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Ticket for getting response from the api</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-use-ticket-for-getting-response-from-the-api/m-p/120826#M33172</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/79410"&gt;@akash251998&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you had a chance to look at the &lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-blog/v1-rest-api-10-things-you-should-know/ba-p/287692" target="_self" rel="nofollow noopener noreferrer"&gt;API tutorial series&lt;/A&gt;? Also, have you tried using Postman for testing before attempting to implement with Python?&lt;/P&gt;
&lt;P&gt;Also, have you looked at &lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-blog/how-to-generate-alfresco-api-client-libraries-part-1-python/ba-p/295797" target="_self" rel="nofollow noopener noreferrer"&gt;Alfresco API client libraries in Python&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;HTH,&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 10:43:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-use-ticket-for-getting-response-from-the-api/m-p/120826#M33172</guid>
      <dc:creator>EddieMay</dc:creator>
      <dc:date>2021-02-17T10:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Ticket for getting response from the api</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-use-ticket-for-getting-response-from-the-api/m-p/120827#M33173</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/76783"&gt;@EddieMay&lt;/A&gt;&amp;nbsp; for again giving quick response as expected from you always.&lt;/P&gt;&lt;P&gt;I resolved that issue by myself only .&lt;/P&gt;&lt;P&gt;I wrote a python code, earlier it was giving 401 Unauthorized file error .. but i used authentication while accessing the url and it works fine.&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;from requests.auth import HTTPBasicAuth&lt;BR /&gt;from urllib.error import HTTPError&lt;/P&gt;&lt;P&gt;try:&lt;BR /&gt;&lt;BR /&gt;response = requests.get('http://your_host:8080/alfresco/service/api/workflow-instances?state=Completed', auth=HTTPBasicAuth('your_username', 'your_password'))&lt;BR /&gt;response.raise_for_status()&lt;BR /&gt;# access JSOn content&lt;BR /&gt;jsonResponse = response.json()&lt;BR /&gt;print("Entire JSON response")&lt;BR /&gt;print(jsonResponse)&lt;/P&gt;&lt;P&gt;except HTTPError as http_err:&lt;BR /&gt;print(f'HTTP error occurred: {http_err}')&lt;/P&gt;&lt;P&gt;&lt;FONT size="5" color="#800080"&gt;&lt;STRONG&gt;Note:The code is compatible with python version &amp;gt;=3&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 10:57:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-use-ticket-for-getting-response-from-the-api/m-p/120827#M33173</guid>
      <dc:creator>akash251998</dc:creator>
      <dc:date>2021-02-17T10:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Ticket for getting response from the api</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-use-ticket-for-getting-response-from-the-api/m-p/120828#M33174</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/79410"&gt;@akash251998&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reporting back how you resolved your issue - that's really helpful to other users.&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 12:07:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-use-ticket-for-getting-response-from-the-api/m-p/120828#M33174</guid>
      <dc:creator>EddieMay</dc:creator>
      <dc:date>2021-02-17T12:07:29Z</dc:date>
    </item>
  </channel>
</rss>

