Click here to Skip to main content
16,017,881 members
Home / Discussions / CodeProject API
   

CodeProject API

 
GeneralRe: For your viewing pleasure ... Pin
Matthew Dennis13-Apr-15 5:45
sysadminMatthew Dennis13-Apr-15 5:45 
NewsFailing downloads Pin
Pete O'Hanlon11-Apr-15 21:05
mvePete O'Hanlon11-Apr-15 21:05 
GeneralRe: Failing downloads Pin
Thomas Daniels11-Apr-15 22:01
mentorThomas Daniels11-Apr-15 22:01 
GeneralRe: Failing downloads Pin
Pete O'Hanlon11-Apr-15 22:10
mvePete O'Hanlon11-Apr-15 22:10 
GeneralRe: Failing downloads Pin
Pete O'Hanlon12-Apr-15 21:53
mvePete O'Hanlon12-Apr-15 21:53 
GeneralRe: Failing downloads Pin
Matthew Dennis13-Apr-15 5:40
sysadminMatthew Dennis13-Apr-15 5:40 
GeneralRe: Failing downloads Pin
Pete O'Hanlon13-Apr-15 5:42
mvePete O'Hanlon13-Apr-15 5:42 
GeneralSome suggestions for API enhancements PinPopular
Mario Z10-Apr-15 9:58
professionalMario Z10-Apr-15 9:58 
I'm currently working on small POC website that shows CodeProject member's Q&A tags statistic (if interested it is available here) and while building it I collected few suggestions which I hope you'll find interesting and/or useful.

- First the easy one, in API documentations on few places the CodeProject APIs are referred as HTML services.
I think this should be HTTP services or better jet RESTful services.

- Somewhat common practice for defining a response's format is to add a format's extension termination on the URL to identify data type you want to request from the server, for example like the following:
v1/my/articles.xml?page={page}
v1/my/articles.json?page={page}

Now whether this is truly a RESTful approach or a best practice is debatable, but as it is now there is a problem of mixing two conventions. You see the versioning does not follow the convention that setting the result format uses. In order for versioning to follow the same convention (a true RESTful approach) it should also be defined in Media Type header, for example like the following:
"application/json;application&v=1"

Nevertheless I must say I don't see any downfall in supporting both approaches, as long as the priorities and the used default values are documented.

- Regarding the MY API, most (if not all) of these currently available GET APIs are publicly available resources. I mean every CodeProject member can look at the other member's Questions, Answers, Articles, etc. so it just feels natural to me that Client Credentials Grant should be required here, not Authorization Code Grant.
Nevertheless I'm not suggesting to change the current MY API (because I presume it is likely that you want to add follow-up PUT, POST, etc. APIs here), instead I'm suggesting to add something like the following:
v1/{userId}/answers?page={page}
v1/{userId}/articles?page={page}

And this API should work on Client Credentials Grant or Implicit Grant flow.

- Regarding the pagination, pageSize should definitely be available for querying together with page and you could specify the pageSize value limitation in the documentation.
So something like this should be supported:
v1/my/answers?page={page}&pageSize={pageSize}

Also I believe a very useful thing could be to provide First, Last, Next and Previous resource locations in PaginationInfo so that the pagination can be processed continuously from the response itself.
For example for the following API:
v1/my/answers?page=3

Could result into something like the following:
JavaScript
"pagination": {
    "page": 3,
    "pageSize": 25,
    "totalPages": 5,
    "totalItems": 25,
    "first" : { "href" : "https://api.codeproject.com/v1/my/answers?page=1" },
    "prev" : { "href" : "https://api.codeproject.com/v1/my/answers?page=2" },
    "next" : { "href" : "https://api.codeproject.com/v1/my/answers?page=4" },
    "last" : { "href" : "https://api.codeproject.com/v1/my/answers?page=5" },
}

Or maybe something like this:
HTML
<Pagination>
    <Page>3</Page>
    <PageSize>25</PageSize>
    <TotalPages>5</TotalPages>
    <TotalItems>25</TotalItems>
    <link rel="first" href="https://api.codeproject.com/v1/my/answers?page=1" />
    <link rel="prev" href="https://api.codeproject.com/v1/my/answers?page=2" />
    <link rel="next" href="https://api.codeproject.com/v1/my/answers?page=4" />
    <link rel="last" href="https://api.codeproject.com/v1/my/answers?page=5" />
</Pagination>


- Partial returned result, so instead of receiving a full result and filtering out the necessary data we could do something like this:
v1/my/answers?page=3&fields=pagination(totalItems),items(id,summary)

And receive only the following:
JavaScript
{
  "pagination": {
    "totalItems": 2
  },
  "items": [
    {
      "id": "100",
	  "summary": "First sample item."
	},
    {
      "id": "200",
	  "summary": "Second sample item."
	}
  ]
}


I hope any of these you will find useful, if you don't mind these type of suggestions let me know and I will continue collecting them and posting here afterword.
GeneralAPI Abstraction Pin
Ranjan.D23-Feb-15 3:58
professionalRanjan.D23-Feb-15 3:58 
QuestionNon-redirect Flows Pin
Ranjan.D21-Feb-15 9:55
professionalRanjan.D21-Feb-15 9:55 
AnswerRe: Non-redirect Flows Pin
Ranjan.D21-Feb-15 14:29
professionalRanjan.D21-Feb-15 14:29 
GeneralRegarding GetArticles Pin
Ranjan.D12-Feb-15 5:32
professionalRanjan.D12-Feb-15 5:32 
GeneralOAuth not work for me: invalid_request Pin
Alеksey Nemiro6-Feb-15 3:26
Alеksey Nemiro6-Feb-15 3:26 
GeneralRe: OAuth not work for me: invalid_request Pin
Matthew Dennis6-Feb-15 4:40
sysadminMatthew Dennis6-Feb-15 4:40 
GeneralRe: OAuth not work for me: invalid_request Pin
Alеksey Nemiro6-Feb-15 5:39
Alеksey Nemiro6-Feb-15 5:39 
GeneralSometimes author name is empty and ID is 0 Pin
Thomas Daniels1-Jan-15 7:26
mentorThomas Daniels1-Jan-15 7:26 
GeneralRe: Sometimes author name is empty and ID is 0 Pin
Matthew Dennis1-Jan-15 7:33
sysadminMatthew Dennis1-Jan-15 7:33 
GeneralRe: Sometimes author name is empty and ID is 0 Pin
Thomas Daniels18-Mar-15 6:44
mentorThomas Daniels18-Mar-15 6:44 
GeneralCan I add a new language syntax to CodeProject syntax highlighter to use in articles? Pin
Emiliarge24-Dec-14 10:29
professionalEmiliarge24-Dec-14 10:29 
GeneralRe: Can I add a new language syntax to CodeProject syntax highlighter to use in articles? Pin
Matthew Dennis24-Dec-14 16:13
sysadminMatthew Dennis24-Dec-14 16:13 
QuestionI'm lost... Pin
Kornfeld Eliyahu Peter23-Dec-14 1:45
professionalKornfeld Eliyahu Peter23-Dec-14 1:45 
AnswerRe: I'm lost... Pin
Matthew Dennis23-Dec-14 9:52
sysadminMatthew Dennis23-Dec-14 9:52 
GeneralRe: I'm lost... Pin
Kornfeld Eliyahu Peter23-Dec-14 20:51
professionalKornfeld Eliyahu Peter23-Dec-14 20:51 
GeneralRe: I'm lost... Pin
Matthew Dennis27-Dec-14 5:02
sysadminMatthew Dennis27-Dec-14 5:02 
Question(How long) is API data cached? Pin
Thomas Daniels9-Nov-14 2:36
mentorThomas Daniels9-Nov-14 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Flags: Fixed

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.