We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,329 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

diafol's dwAPI microsite

Hi all, following a chat with Dani, I'm just posting an example of a jQuery OAuth implementation. Major updates to come over the next weeks and months, but it's a start. I'll be publishing the code once I've cleaned it up and de-noobified it somewhat. :)

http://dw.diafol.org/

2
Contributors
28
Replies
1 Day
Discussion Span
2 Months Ago
Last Updated
93
Views
diafol
Keep Smiling
Moderator
10,668 posts since Oct 2006
Reputation Points: 1,632
Solved Threads: 1,514
Skill Endorsements: 57

I get a 500 server error :(

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Fixed!

Yep, I was having issues with GETTEXT, so had to swap a few include files around - but I got them in the wrong order!

diafol
Keep Smiling
Moderator
10,668 posts since Oct 2006
Reputation Points: 1,632
Solved Threads: 1,514
Skill Endorsements: 57

I love the Twitter Boostrap look!! Spiffy!!

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Two things ...

  1. You probably want to pass ?include_self=1 when you fetch /forums/descendants to include the top level categories as well, and not JUST their descendants.
  2. I'm not sure if it's related to that or not, but my list has an article that says f: undefined. It points to this thread: http://www.daniweb.com/hardware-and-software/microsoft-windows/viruses-spyware-and-other-nasties/threads/448757/cannot-download-attachments-in-gmail
Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Thanks for the heads up. I didn't know about the include_self! OK, I just hope I get the same json format :)

diafol
Keep Smiling
Moderator
10,668 posts since Oct 2006
Reputation Points: 1,632
Solved Threads: 1,514
Skill Endorsements: 57

OK, I just hope I get the same json format :)

You will! However, it seems like it isn't able to determine the forum name when you're in a sub-forum, like one of the sub-forums within Microsoft Windows. Are you sure you're pulling descendants and not just children?

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Ok, I've added the parameter - does it work for you now?

diafol
Keep Smiling
Moderator
10,668 posts since Oct 2006
Reputation Points: 1,632
Solved Threads: 1,514
Skill Endorsements: 57

No :(

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

OK, I'll hard code your fave forums into my code and see if I can replicate the problem.
Hmm, it's stopped working - can't splice the json - did you change anything?

Ah - I now see the "0": etc 'keys'

diafol
Keep Smiling
Moderator
10,668 posts since Oct 2006
Reputation Points: 1,632
Solved Threads: 1,514
Skill Endorsements: 57

I didn't change anything????

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Oh shoot, you're right! I did break something!! Fixing ......

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Fixed. Sorry about that.

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Don't ya just love working with a moving target API? :)

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

GRR, not fixed ... hold on :)

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

NOW fixed.

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

OK, you've officially given me a freaking headache. :)
He he.

diafol
Keep Smiling
Moderator
10,668 posts since Oct 2006
Reputation Points: 1,632
Solved Threads: 1,514
Skill Endorsements: 57

I was trying to add pagination and I accidentally put the pagination object inside the data object ... All good now.

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

OK, I think I tracked down the problem. If you have a top-level forum as your favourite, then children don't get taken into account in my code, so although the posts will be extracted, the program can't identify the forum as it has no id-title array item. OK, that went totally over my head until now. I've been beating my head against a wall as to why Forum 10 kept showing an undefined title. :)

//OK I think I've sorted it now - that was horrible :( Managed to sort it without a recursive function - but will probably need to do that to tidy up the code.

I extracted json from the nested forums (without descendants and include_self) as that allowed me to search children easily (nested loops).

diafol
Keep Smiling
Moderator
10,668 posts since Oct 2006
Reputation Points: 1,632
Solved Threads: 1,514
Skill Endorsements: 57

Diafol,

I might be confused, but I don't think that you should need to do any type of nested loops.

Just look at the list of my favorite forums when you pull /me

Then, do:

http://www.daniweb.com/api/forums/1;2;3;4;5/descendants?include_self=1

This will give you a flat list of all of my favorite forums and all their descendants.

Dani
The Queen of DaniWeb
Administrator
21,359 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1214 seconds using 2.71MB