API stands for Application Programming Interface. A program's API defines the proper way for a developer to request services from that program.

learn more… | top users | synonyms

1
vote
3answers
222 views

Fail-safe remote API operations for managing customers and billing

I'm working with two remote APIs: one which manages customers and the other (a Paypal API interface) which manages billing. To delete an account, I must delete the records from both. ...
1
vote
0answers
16 views

A standard PHP script for API requests [closed]

I am setting up some PHP pages to provide API services to users (and my applications). In its most basic form, it looks like this: ...
2
votes
2answers
55 views

Move code from controller to model

I'm working a rails application that has a lot of logic in the controller that should be in the model. In the app/controllers/customers_controller.rb#create there ...
1
vote
2answers
61 views

Simple and concise new iterator design [closed]

I came up with a new iteration pattern for a C++ API that aims at simplifying client code. Basically, when developers have an iterable object myCollection, they ...
5
votes
2answers
153 views

Restful API Building: Dependency injection + factory patterns

I am learning OOP. I feel I have a grasp of basic dependency injection in that as a rule of thumb, you pass an object to a method rather than the parameters to create an object. As such, never create ...
18
votes
2answers
1k views

C++ API for interfacing with Lua

I wanted a good way to move objects back and forth between Lua and C++, and I didn't want to use anything like LuaBind or the other available libraries I could find, so I instead wrote this. It's ...
6
votes
1answer
201 views

Library for providing calculations in Java

I'm working on a library which will provide easier writing and calculations in Java using a fluent API. This is the library I have implemented with basic functionalities and am now working to improve ...
3
votes
0answers
81 views

JavaScript API for REST

I have a REST API, which naturally you can just use HTTP calls (mainly Ajax) in order to send and receive data. I am building a layer of abstraction on top of the raw REST API for JavaScript ...
11
votes
1answer
343 views

Sending a C++ array to Python/NumPy and back

I am going to send a C++ array to a Python function as NumPy array and get back another NumPy array. After consulting with NumPy documentation and some other threads and tweaking the code, the code is ...
0
votes
1answer
52 views

Naming a complex crud function

I have a function below that does the following uses a bunch of smaller CRUD operations which I call create, ...
1
vote
2answers
156 views

Bignum library with arbitrary bases

I just started development on a new bignum library that can operate on numbers of any arbitrary base (up to 232). I want to get a good idea of where I can improve before taking things any further. ...
5
votes
2answers
293 views

Slim API with 3 layer architecture

I'm new to Slim and the three layered approach I'm using below. So far I have the API, a Presentation layer (leaving out for now), a Business Logic Layer, and a Data Access Layer. The code's working, ...
5
votes
2answers
197 views

External API calls from a C#.NET client

I have a simple c# mvc client that calls an external api..here is my attempt ...
1
vote
1answer
59 views

System to handle the short lived async task

I'm developing an application in which there are many short-lived tasks which are run in separate threads. I've developed a generic and reusable system to handle such a requirement. The code snippet ...
2
votes
3answers
72 views

Fast tag replacements

This uses the Stack Exchange API to quickly batch replace tags in questions. I still need to fully comment and make the Wiki, but are there any glaring mistakes in it? I have tried to use ...
0
votes
0answers
59 views

PHP connector for communicating with a REST API (part 2)

I wrote a PHP connector that will allow me to communicate with a REST API using PHP. The class was little over 1500 lines of code, it was difficult to manage it. It was a nightmare to even look at it ...
2
votes
1answer
84 views

PHP connector for communicating with a REST API (Part 1)

I wrote a PHP connector that will allow me to communicate with a REST API. This is the first time I am trying to make my code as clean as possible. I want to help myself learning how to better code. ...
5
votes
1answer
74 views

Uses game API to post stats about user when requested

First Python script, so my code is pretty laughable. Sensitive information has been redacted. One thing that I'd like to point out is that there is an inconsistent use of '' and "". This is an old ...
12
votes
1answer
228 views

Inspector Rubberduck

Our Rubberduck open-source VBE add-in project is coming along nicely. One of the main features we're going to be implementing in the next release, is code inspections. I started by defining an ...
2
votes
0answers
47 views

Restful API for parsing records

I'm trying to implement my own API. This code excerpt should show the basic working routines. The storage is temporary an in-memory-array and the only HTTP method for now is POST. I outsourced the ...
3
votes
2answers
66 views

Removing nested for loops to hasten API call response time

I've got an MVC APU project that I'm working on to feed data to some JavaScript charts. This beast below takes nearly 1 second of server time to process before it is served to the chart. I know that ...
8
votes
1answer
138 views

The effect of typing a sentence out

The following code is complete and works perfectly. What I want to do to is make it more modular in a way where I can use the code again - similar to an api. I also hardly ever code in javascript, ...
5
votes
1answer
54 views

Attempting a fluent API for creating random int arrays

I have attempted doing a fluent API for creating random int arrays, and the following is what I came up with: fluent_arrays.h: ...
3
votes
1answer
221 views

Handling new user requests from a Swift client

I am starting to play with POST request to save in my server the user token so I can send push notifications in Swift (this is the swift code). This is the PHP file that processes the request (please ...
3
votes
2answers
221 views

REST API using PHP

I am trying to write an REST API using php from scratch which I am gonna use to play with Angular.js. It is working fine now and I need your opinions on the things I have done in this code to improve ...
1
vote
1answer
43 views

Fetching ALL data set from API iterating via response data

Does this make sense? How would you achieve the same thing, with cleaner code? ...
2
votes
1answer
90 views

Web API controller to get details of a travel plan or a leave request

My web API has 3 controllers for get, post and users CRUD. I named it as DetailsControllor, FormControllor and ...
4
votes
1answer
173 views

Swift API controller

I've just started iOS development and learning Swift. My code below works, but I'm interested to know in ways I can improve it having no experience in iOS Swift prior to this attempt. ...
3
votes
0answers
43 views

Entity component system Lua API

The destruction of the objects are handled by the garbage-collector metamethod. (Does this make sense? This means that an out-of-scope object will stay visible in game until garbage collection.) The ...
1
vote
0answers
133 views

Imgur API implementation using Retrofit

I've recently (an hour ago) started a project for making a wrapper for Imgur's API using the REST client Retrofit. I've only implemented a single endpoint so far as I'm questioning my design. While ...
3
votes
1answer
132 views

Perl wrapper library (written using Moose) for a REST API

I wrote a wrapper library for a REST API (https://semantics3.com) in Perl using the Moose library. I would like to gather some feedback on it (mainly on the OOP part since I am new to moose), before ...
0
votes
2answers
50 views

Should Domain objects for a public API be able to save/send themselves?

My main questions: FileWithSave handles its saving itself, but delegates it to a repository object. This allows implementation details to be available without being present in the API when saving ...
10
votes
1answer
168 views

The thing that makes API requests

I'm creating a thing that does things. Part of the things the thing does is querying an API for information about movies and TV shows. The API allows me to query for changes to their data so I will ...
6
votes
2answers
538 views

Generating code with XML

I'm working on my graduate project and I had stumbled upon a somewhat dilemma, I've managed to solve it with some workarounds but I have my doubts that this is the most efficient way to deal with this ...
20
votes
3answers
697 views

Parsing log files of HearthStone: The log reading API

I'm still working on a parser that can parse log entries from a game called HearthStone, the overall idea is that it will read the log file live when the game is running, parses the log file and show ...
3
votes
2answers
7k views

RSpec integration tests for a simple Rails API

The Model is simple. A Player class with three attributes: first_name, last_name, and team_id. I'm just trying to get a handle on TDD for what will expand into a much more robust API. Below is my ...
2
votes
1answer
120 views

Expose only desired functions to 3rd party plugins in JavaScript

I tried to build a solution to dynamically load JS code, but to only expose predefined functions. Is this the correct approach? Is there any Method to execute arbitrary code if I put all my code ...
3
votes
1answer
76 views

Catching API changes for a service that doesn't version its API

I'm using the old Google Data API to access several spreadsheets and put their contents in a database using Flask and SQLAlchemy. Each run deletes the contents of the database tables and repopulates ...
3
votes
2answers
1k views

Task scheduler API

I'm spec'ing out a API for a task scheduler and I would be thankful for your thoughts. This is what I've got so far: ...
3
votes
1answer
462 views

Protecting certain model attributes from being exposed in an API

There can be a business or security requirement that certain fields on a model should never be exposed in an API. One approach to this is to tell the developers not to ever put the field in the API ...
5
votes
2answers
148 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 ...
2
votes
1answer
3k views

PHP/Phalcon RESTful API architecture

I'm building a RESTful API in PHP using the Phalcon framework. The API will consist of multiple modules (e.g. api.example.com/mail/users, api.example.com/web/users, etc). So I want to put all module ...
11
votes
2answers
800 views

Parsing log files of HearthStone: The API

I am working on a parser that can parse log entries from a game called HearthStone, the overall idea is that it will read the log file live when the game is running, parses the log file and show ...
4
votes
1answer
410 views

Steam API JSON Function JavaScript

Upon coming face to face with the mighty cross-origin request block, and needing to get a JSON file from an external source, I decided to use the Yahoo Query Language in order to achieve this. I'm ...
1
vote
1answer
70 views

Vimeo API - Loading videos

I know my way around jQuery and JavaScript a little bit but as for optimising, I'm a bit weak but willing to learn new stuff. I'm currently loading videos onto our site from Vimeo when a user clicks ...
3
votes
1answer
476 views

Testable authentication handler for web API

I need to unit test my authentication handler. I don't really want do an assert against the text message returned by the handler. How could this be improved ? ...
2
votes
1answer
113 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 ...
5
votes
1answer
346 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 ...
6
votes
2answers
2k views

Security of API Keygen for a cryptocurrency trading platform

Below 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 ...