Questions tagged [api]

API, for code implementing (not using) an Application Programming Interface. A program's API defines the proper way for a developer to request services from that program, site and/or service.

Filter by
Sorted by
Tagged with
11
votes
2answers
10k views

Logging into WebAPI 2 site from c# desktop application

I'm trying to login into a webapi2 site from a desktop application. After a lot of googling, I cobbled together a working prototype. Since we are talking about security I wanted to do a peer review. ...
5
votes
1answer
369 views

Reducing complexity of method

I'm trying to reduce the complexity of some methods, and I'm not exactly sure what approach to take. I'm currently building a PHP wrapper for a REST API, and the main problematic class is here: https:...
1
vote
1answer
352 views

Orchestrate.io Client API Design

I've written a Python client for a new NoSQL database as a service product called Orchestrate.io. The client is very straightforward and minimal. It uses the requests library, making the underlying ...
4
votes
1answer
1k views

PHP wrapper around an API - best practices

Here's a PHP wrapper around a public OAuth2 REST API. I would love to hear your thoughts and comments. Testing was a bit frustrating since I tried for my first time. Not sure if I have done the ...
2
votes
1answer
96 views

Backend interface VS hard contract

Here is an API for using a warehouse: ...
10
votes
2answers
1k views

Java API without exposing implementation details

I am creating an API for consumption by other developers to interface with an internal framework. My goal is to be able to have the developers type something like: ...
5
votes
1answer
3k views

XLSX writer implementation

We have multiple scripts which write into XLSX with the same format, into a different format or slide variation. I am trying to write an API which saves time for other programs, but I need input on ...
10
votes
4answers
388 views

XmlCmdBuilder - doing away with inline xml

I have to work with a 3rd-party API that allows me to define and execute "commands", using XML. Since I don't like seeing mixed abstraction levels, I managed to remove all the inline XML / string ...
2
votes
1answer
2k views

Generic java configuration class with type safety

In the first code snippet I am creating a generic class to hold configuration details. I am currently using it as a way to pass run time configuration options to plugins in a generic manner. The ...
6
votes
2answers
783 views

Computing the electricity consumption of a client

I have a year or so of experience in developing in Java. I submitted the solution for this task, but never got the feedback that was promised. Since I still would like to get a feedback on my solution,...
7
votes
2answers
5k views

Security of API Keygen for a cryptocurrency trading platform

Here is an API key gen script for a cryptocurrency trading platform I am building. First it checks to see if a key exists in the db for the user ID. If it does exist, it displays the key. If it doesn'...
0
votes
1answer
159 views

Evaluating a hashing function used to create secure API key

What are your thoughts on the following code? is it secure enough? Note: $password is used to represent the secret, which would essentially be a SHA512 hash of <...
1
vote
1answer
93 views

Reddit Investigator-like JS app

I am building a one-page JS app similar to redditinvestigator.com, and my goal is for it to be 100% done in JavaScript. Coming from a PHP/Java background, I'm more used to working in class oriented ...
3
votes
2answers
1k views

Structure of API wrapper

I'm building an API wrapper for a bookkeeping SOAP API. I have some questions regarding bast practice for structure of the wrapper and for error handling. For now i've structured it like this: ...
5
votes
1answer
424 views

In-memory data cache architecture for data transfer

I am writing a cron job to manipulate and transfer remote data. I need to cache data from a table, process it, merge with previous table, iterate the process, and eventually send the result data to ...
2
votes
1answer
255 views

Rails 4.0 api_key implementation

I have a concept of the user having many API keys, but the API key belongs to the user, so I did the following: config/routes.rb ...
5
votes
2answers
6k views

Multiple serial URL requests in Objective-C / iOS

I want to check the existence of various API endpoints by doing serial URL request. If the first one fails, I want to try the second one, if the second fails I want to try the third one, etc. Here is ...
6
votes
3answers
796 views

Retrieving information and images for rental properties using an API

I would like advice on making my code more elegant and straightforward. The code works great, but it lacks these things. ...
4
votes
1answer
80 views

RESTfulPHP / controller / structure

Allow for stuff like: API/ExampleObjects API/ExampleObjects/SOME_INTEGER_ID/Children ... with children knowing their owners (aka parents). Full repo here Please be brutally honest if something can ...
1
vote
1answer
7k views

Node.js DynamoDB callback

I am writing an API which gets results from a DynamoDB table and puts the JSON back into the browser. The code below works and returns the desired results. However, after reading about async and ...
6
votes
2answers
5k views

WebAPI - Return models vs entity and partial class with meta data

Wanted some opinions on something I have been working with, I've tried a few ways of structuring the way I retrieve and return data to my WebAPI, and I'm pretty happy with what I have so far, but I ...
4
votes
0answers
136 views

Core class of a JavaScript framework for Single-Page-Applications

A few years ago I started building a tiny (~300 SLOC) JavaScript framework for scalable and maintainable Single-Page-Applications written in CoffeeScript. GitHub www.scaleapp.org It's inspired by ...
6
votes
1answer
981 views

API wrapper for translating XML requests and responses into objects

I'm looking for remarks on pretty much anything. This has been my first project that's meant for use by others and I'd like to have it as clean as possible. I will post the main source code here but ...
11
votes
2answers
936 views

Date Format provider

I am facing a issue with an API to handle dates in Java. I am not a very experienced programmer and my English is very bad. Problem I'm working in a large project with many subsystems, and I want to ...
1
vote
2answers
80 views

Client's method for channel subscribing

I am writing an open-source application for real-time messaging in web. In my application clients from browser can subscribe on channels. But every channel belongs to a certain namespace which ...
2
votes
1answer
324 views

How can I refactor Api::SessionsController?

I have session controller for mobile devices. I would like to refactor it a little, for example because my session controller is sub class of ...
1
vote
1answer
511 views

How should I refactor my image uploader script?

I come from a C background and need help refactoring the following imgur image uploader script I wrote. It checks if a token_file with ...
1
vote
0answers
585 views

Requesting data from the Twitter API

I have this PHP script below that requests data from the Twitter API. The script then displays it on a page according to the information that I have in my local database. I stored Twitter real ...
2
votes
1answer
682 views

Designing function prototypes for a singly-linked list API in C

I am in the process of rewriting in C all the data structures that I learned about a few years ago to increase my understanding of data structures and the C language. The first one I'm doing is singly-...
0
votes
2answers
1k views

How is this for an API structure

I have just written an API framework which I am hoping to implement into one of my large sites very soon. However, before I do so, I want to be sure that the script is well written and there are no ...
2
votes
1answer
203 views

Refactor code for API wrapper

I am looking for ways to improve my API wrapper for Pocket. So far, my code is quite compact and nice (I think), but I feel like there must be a better way to do this. This is the part where I think ...
2
votes
0answers
86 views

Stream-chaining

My goal is to have a reusable pattern for doing concurrent stream-processing in Go. The stream has to be closable from any node. Errors should cleanly close the stream and forward the error to the ...
3
votes
3answers
5k views

REST-ish API Account Controller

I still have to implement API keys for client auth, but so far this is what I have for users. This was built using WebAPI and SimpleMembership with Forms Auth: Is Authenticated: ...
10
votes
1answer
142 views

Key Press Handler

I have made a class to import into my projects to more easily handle the state of the keyboard so I can use stuff like: if(Keys.returnKey(37)){ As opposed to ...
2
votes
2answers
806 views

Is it ok to use PHP's strpos and substr altogether in one statement?

I am using PHP to build a REST API. I want to receive requests from the URL in the following format: http://mydomain.com/api/format/method?app_id=value&call=encrypted_request So, I have modified ...
3
votes
1answer
615 views

Object serializer

I have this little utility/helper which serializes a form into a javaScript object. ...
6
votes
1answer
327 views

Doubts about the quality of an API designed for use with minimal effort

I'll try to provide exactly the amount of context that is necessary to understand the construct. I built an API (well, a small part of one) that works and is kind of usable, but rather unpretty and ...
3
votes
1answer
192 views

jQuery plugin boilerplate jquib

Inspired by jqueryboilerplate.com, I extended their boilerplate to fit my needs. Coming from PHP development, I wanted to have a good starting point for writing jQuery plugins with a defined API/...
4
votes
1answer
2k views

Backbone.js Dependency Injection API Design

I'm writing a dependency injection plugin for the Backbone javascript framework, and I'm not sure what the API for constructor argument injection should look like. Just for reference, Backbone ...
1
vote
1answer
205 views

Music management app, mashing data from various APIs

I am basically getting data from various APIs and using PHP to put them together - like a web mashup. I am currently using 4 foreach statements to insert the ...
2
votes
1answer
1k views

Finding the max subset of non-overlapping intervals

How could this code become cleaner? I think that the way I handle the interfaces and binary search could be improved. I am trying to understand how to structure such a code (and usage of APIs) in a ...
0
votes
1answer
244 views

Accessing a REST API with PHP

I'm currently using a scientific information management system that employs a RESTful API. I've never used this API with PHP, and I had a hard time finding best practice examples online. After some ...
2
votes
1answer
2k views

Is there a better way to loop through records and call an api?

I have a CakePHP function here that gets info for a twitter screen_name from the twitter api and writes it to a mysql db. I'm just looking for feedback about other ways to accomplish this that might ...
2
votes
1answer
219 views

Creating JavaScript API for first time; request review

I am creating a commercial API for the first time for responsive webpages/web applications (mobile devices). I am new and, sadly, working alone as well as new to Javascript (long complicated story). ...
1
vote
2answers
515 views

PHP api design - anything done badly?

I have created an api in php and I was hoping some clever individuals would mind reviewing it to see what I could do better. I have commented it heavily to explain my reasoning. please feel free to ...
11
votes
1answer
500 views

Wrapper class for the Rotten Tomatoes API

I'm working on a site that has to do with movies. I am consuming the Rotten Tomatoes API to get my movie information and using EF5 with a code first approach to get that into the database. I'm using ...
2
votes
1answer
132 views

JavaScript API that loads and houses libraries of code

I have written a JavaScript API that loads and houses libraries of code to do all sorts of things on websites. Effectively, this is (will be) the base JavaScript for all the websites I build. The ...
3
votes
1answer
785 views

Very simple async MixpanelAPI

I would love to hear feedback on my first open source project (a very simple async API for Mixpanel). It implements a REST client for this REST HTTP API. Review requested on the following aspects: ...
2
votes
3answers
540 views

ACM API based Java exercise

I came across an exercise (in the book "The Art and Science of Java" by Eric Roberts) that requires using only GArc and GLine classes to create a lettering library which draws your initials on the ...
5
votes
1answer
416 views

Loading JavaScript libraries with PHP API

I have written the following script which simply: Loops through JavaScript files (either defined in a particular package, or separately with the libraries array) Reads the files into the script and ...