Been running a couple of article queries this morning.

When running http://www.daniweb.com/api/articles?forum_id=61 I encountered what looks like a bug.

The 11th thread reply coming back in the query is the following:

{
   "title":"please help me  .........",
   "related":[
    {
     "id":""
    }
   ],
   "posters":[
    {
     "id":"1098860"
    },
    {
     "id":"46588"
    },
    {
     "id":"1091071"
    }
   ],
   "uri":"http:\/\/www.daniweb.com\/software-development\/csharp\/threads\/472052\/please-help-me-",
   "id":"472052",
   "forum":{
    "id":"61"
   },
   "replies_count":"2",
   "views_count":"20",
   "first_post":{
    "timestamp":"1390849755",
    "id":"2060455",
    "poster":{
     "username":"0914541592",
     "id":"1098860"
    },
    "raw_message":"2.\tAn integer greater than 1 is said to be prime if it is divisible by only 1 and itself. For example, 2, 3, 5 and 7 are prime numbers, but 4, 6, 8 and 9 are not.\na) Write a function that determines whether a number is prime.\nb) Use this function in a program that determines and prints all the prime numbers between 2 and 1,000.\nc) Initially, you might think that n\/2 is the upper limit for which you must test to see whether a number is prime, but you need go only as high as the square root of n. Rewrite the program and run it both ways to show that you get the same result.\n"
   },
   "type":"threads",
   "last_post":{
    "timestamp":"1391014107",
    "id":"2061046",
    "poster":{
     "username":"humorousone"
    }
   }
  },

Note how in the related threads section, it shows a thread is returned however no ID for this thread is actually given (Line 5).

When looking at the actual forum thread (http://www.daniweb.com/software-development/csharp/threads/472052/please-help-me-) there are 10 related articles shown on the side.

Also if I run http://www.daniweb.com/api/articles/472303 which is the direct query for that article the related articles appears be broken also.

{
 "data":[
  {
   "title":"please help me  .........",
   "related":[
    {
     "id":""
    }
   ],
   "posters":[
    {
     "id":"1098860"
    },
    {
     "id":"46588"
    },
    {
     "id":"1091071"
    }
   ],
   "uri":"http:\/\/www.daniweb.com\/software-development\/csharp\/threads\/472052\/please-help-me-",
   "id":"472052",
   "forum":{
    "id":"61"
   },
   "replies_count":"2",
   "views_count":"20",
   "first_post":{
    "timestamp":"1390849755",
    "id":"2060455",
    "poster":{
     "username":"0914541592",
     "id":"1098860"
    },
    "raw_message":"2.\tAn integer greater than 1 is said to be prime if it is divisible by only 1 and itself. For example, 2, 3, 5 and 7 are prime numbers, but 4, 6, 8 and 9 are not.\na) Write a function that determines whether a number is prime.\nb) Use this function in a program that determines and prints all the prime numbers between 2 and 1,000.\nc) Initially, you might think that n\/2 is the upper limit for which you must test to see whether a number is prime, but you need go only as high as the square root of n. Rewrite the program and run it both ways to show that you get the same result.\n"
   },
   "type":"threads",
   "last_post":{
    "timestamp":"1391014107",
    "id":"2061046",
    "poster":{
     "username":"humorousone"
    }
   }
  }
 ],
 "pagination":{
  "total":"1",
  "per_page":30,
  "page":1
 }
}

Is this functioning correctly?

Recommended Answers

All 6 Replies

This also occurs when querying the community feedback forum with the current 28th post in the list having an identical issue.

PostID: "469250"

The articles you're referring to have no related articles. The web interface fakes it and shows featured articles in the same forum. I'll make the API fake it too.

Thanks :), it doesn't have to fake it though, just didn't know if that was correct or not.

I can code to handle there being no related articles.

That's your choice what to do though :)

I think it makes sense to match up with what live DaniWeb shows, even if both are equally faked.

I guess so yes, consistency would be the best option.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.