How to extract Tags relevant to a Section

152 views
Skip to first unread message

Shahood ul Hassan

unread,
Nov 13, 2017, 10:12:13 AM11/13/17
to Guardian Open Platform API Forum
Hello all,

I'm new to coding and have been learning Android programming for the past few months in my free time. I have been exploring this API for some days and wanna use it to build an app as part of my android online course assignment. I want to give users a list of all available sections and when they select a section, the next list should show all tags related to that section.
Tried to achieve this by http://content.guardianapis.com/sections?api-key=test&show-tags=all which shows a list of sections but not their relevant tags. If i achieve it with the help of writing code, i will have to first call news related to a section, then go through each one to collect all the tags, remove duplicates and then make a list of the unique ones. Thats a lot of code plus a lot of network calls.
So, is there any other way i could directly achieve this with the help of APi alone?

Thanks


Shahood ul Hassan

unread,
Nov 16, 2017, 8:26:58 AM11/16/17
to Guardian Open Platform API Forum
Anyone?

@Mariot Chauvin

Mariot Chauvin

unread,
Nov 16, 2017, 9:21:02 AM11/16/17
to guardian...@googlegroups.com
Hi Shahood,

You can't retrieve tags associated to section because they are not linked at all.
Both concepts live independently, so you can find content with any tag as part of a section.

Hope this help,

Mariot  

--
You received this message because you are subscribed to the Google Groups "Guardian Open Platform API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-talk+unsubscribe@googlegroups.com.
To post to this group, send email to guardian-api-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/guardian-api-talk.
For more options, visit https://groups.google.com/d/optout.



This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way.  Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software.
 
Guardian News & Media Limited is a member of Guardian Media Group plc. Registered Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP.  Registered in England Number 908396


Shahood ul Hassan

unread,
Nov 16, 2017, 10:21:08 AM11/16/17
to Guardian Open Platform API Forum
Thanks but then why do we see section_Id as kind of a prefix to every tag_id?

For example, technology/google, technology/apple, politics/conservatives, politics/labour, society/social-care, society/policy. Apparently, there is a linkage or otherwise the tag_id would simply have been google, apple, conservatives.....etc.

On Thursday, 16 November 2017 19:21:02 UTC+5, Mariot Chauvin wrote:
Hi Shahood,

You can't retrieve tags associated to section because they are not linked at all.
Both concepts live independently, so you can find content with any tag as part of a section.

Hope this help,

Mariot  
On 16 November 2017 at 13:26, Shahood ul Hassan <sha...@gmail.com> wrote:
Anyone?

@Mariot Chauvin


On Monday, 13 November 2017 20:12:13 UTC+5, Shahood ul Hassan wrote:
Hello all,

I'm new to coding and have been learning Android programming for the past few months in my free time. I have been exploring this API for some days and wanna use it to build an app as part of my android online course assignment. I want to give users a list of all available sections and when they select a section, the next list should show all tags related to that section.
Tried to achieve this by http://content.guardianapis.com/sections?api-key=test&show-tags=all which shows a list of sections but not their relevant tags. If i achieve it with the help of writing code, i will have to first call news related to a section, then go through each one to collect all the tags, remove duplicates and then make a list of the unique ones. Thats a lot of code plus a lot of network calls.
So, is there any other way i could directly achieve this with the help of APi alone?

Thanks


--
You received this message because you are subscribed to the Google Groups "Guardian Open Platform API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-t...@googlegroups.com.
To post to this group, send email to guardian...@googlegroups.com.

Mariot Chauvin

unread,
Nov 16, 2017, 10:38:29 AM11/16/17
to guardian...@googlegroups.com
Hi Shahood,

Sorry I misunderstand what you were trying to, and answered wrongly.
 Indeed a tag has always a section, and to retrieve all tags that have a particular section you have to use the section filter on the tag endpoint.

tags?page-size=100&type=keyword&section=lifeandstyle      

Hope this help,

Mariot 

To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-talk+unsubscribe@googlegroups.com.
To post to this group, send email to guardian-api-talk@googlegroups.com.

Shahood ul Hassan

unread,
Nov 16, 2017, 10:53:00 AM11/16/17
to Guardian Open Platform API Forum
Wow....thanks a lot. Exactly what i was looking for!
Now is it possible to get 0 news items if we click on any of the section/tag combo or this combo is created only when it is being attached to a news item?

Mariot Chauvin

unread,
Nov 20, 2017, 6:55:05 AM11/20/17
to guardian...@googlegroups.com
it is possible to get 0 news items 

To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-talk+unsubscribe@googlegroups.com.
To post to this group, send email to guardian-api-talk@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages