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
8
votes
3answers
225 views

Getting information about music that is popular in a country

I have this code below that has 6 distinct parts: Necessary imports Get the top artists from a specific country using last fm api Get some info about this returned artists Get top albums from that ...
0
votes
1answer
64 views

Haskell Servant - login endpoint with two error states

Here is one a handler for dealing with logins, I've recently refactored it to try and make dealing with the different error cases a bit more elegant, though I still think there is room for improvement:...
1
vote
0answers
169 views

WebSocket based API library in Julia

I made a very bare-bones API "library" in Julia which should abstract the interaction with the API. The API is fairly complex - it's based around 2 core layers an HTTPS/REST API for general ...
7
votes
1answer
210 views

ApiClient with http communication in Qt

This is my first code review request on this page. I tried to simplify my ApiClient as much as possible. The full version is also on GitHub. I thought very long about how to design the API client ...
0
votes
1answer
178 views

Wrapper class for calling external API [closed]

I have a PHP cronjob script. I need to send requests and get responses from some external API. So, there is code for the API class. In this class, I connect to the API and call public methods of ...
4
votes
2answers
464 views

An API consumer

I built a minimal working model of a consumer of a RESTful API in Python 3.6. It only consumes one end point in this example. It is using the API from a video game (Destiny 2) to collect data about ...
3
votes
1answer
132 views

Attaching Facebook messenger bot to all pages of the user logging in

I have to create open source code that allows a user to login to Facebook through an app and attaches that app's messenger bot to the user's pages. I have never written open source code before so I ...
4
votes
1answer
92 views

Download and concatenate text files from multiple API endpoints

Background Chronicling America is an archive of digitized US newspapers hosted by the Library of Congress. The site allows programmatic access of its resources through an API, one part of which is ...
0
votes
1answer
59 views

Translating words from one language to another

My program translates words from one language to another using a language Pivot and systran.io API. I used promises, callbacks and external API for the first time but I'm not sure that's the best way ...
2
votes
1answer
68 views

Validating list of values to be sent to API

I'm currently writing a client library to use with a courier's SOAP API to create and manage shipments. I'm using the service classes generated from the WSDL provided by the courier, their ...
2
votes
1answer
145 views

Authentication API script

I have coded a script that I run when I need to verify the authentication for a user, I use it as a php script and host it on api.mydomain.com. It just simply checks to see if the user details are ...
1
vote
0answers
30 views

Factory method to make JSON requests for various types of list items

I have the following code: ...
3
votes
1answer
68 views

Fast prototype code to hook up a webcam to the Azure Emotion API

Last week I had a 5 hours school project deadline based on the Azure Emotion API. Right now I am trying to rewrite the same code in a more clean/elegant way. I am quite new to coding so I will need ...
8
votes
2answers
751 views

Python Export Decorator

In Python, we use __all__ to explicitly denote the public API of a module or package. That looks like this: ...
2
votes
0answers
917 views

Adding support of HTTP PATCH

I have an API endpoint to modify a race car, which supports the PUT method: PUT /api/racecars/{racecarId} Since PUT must be ...
2
votes
0answers
2k views

Serial Port Wrapper with Internal Blocking Buffer

Here I have some complete working code but some aspects seem questionable to me. What I have done is written a wrapper for the Microsoft serial port (...
4
votes
2answers
488 views

Python script using Minneapolis / St. Paul Metro Transit's API to tell you how long till next bus

I have written a program which will tell you how long it is until the next bus on “BUS ROUTE” leaving from “BUS STOP NAME” going “DIRECTION” using the api defined at http://svc.metrotransit.org/. ...
3
votes
2answers
309 views

PHP class to send CRM records to Five9 API

I am experimenting with the Five9 API and setup a PHP class to deal with the addRecordstoList method. The main issue this class was meant to solve over the traditional function found in their ...
7
votes
1answer
144 views

A PHP API which has an endpoint for processing a user's facebook login details

I'm working on a PHP API for my angular JS Phonegap application. At the moment I'm focusing on working with a user's facebook public profile data. I'll explain the process a little first: The user ...
4
votes
1answer
129 views

Quant Trading Robot #1 - API Calls

I'm (re)building a Quantitative Trading Robot in Python. Description: This is my module for API Calls. The API documentation can be found here. This is the direct interface layer between my code and ...
4
votes
1answer
86 views

Translating sentences with an API wrapper

I've written a wrapper for this handy Yandex Translate API. I am pretty happy with is as it works just fine and the translations are accurate, even translations of entire sentences. However, I am ...
1
vote
1answer
83 views

Simple static JSON - get only - API

This API's aim is to return color-names for a bunch of hex colors. Its the first time I am writing an API. And while I write lots of frontend code I rarely touched node. I am interested in a general ...
1
vote
2answers
105 views

Materiel position query for a war game written in Unity

I am making a tank game. I have a database on a server where I store information about Tank itself, Hulls, Turrets, and Guns. When the server gets "Hull" request it returns all needed information ...
4
votes
0answers
470 views

Update UI once all API calls are done

I'm learning Swift at the moment but I would like to produce well-organised code. The goal of my little app is to display the weather of my current location. I use : the API of Darksky : https://...
2
votes
2answers
198 views

Laravel lumen : Post API method

Question is quite simple, I am using dingo package, Currently below is my code for an API call. ...
6
votes
1answer
329 views

Getting prices of crypto coins

I have been working on this Raspberry Pi project for a while. It uses the Poloniex API to get prices of crypto coins and it shows the prices on multiple OLED displays. The displays use different i2c ...
2
votes
2answers
182 views

API with revealing module pattern in Javascript

I'm working on a project where I want to create a API that can be used to do some mathmatical calculations. Here are the important aspects: I used the revealing module pattern I added method ...
4
votes
1answer
88 views

API , client program and daemon to read and set screen brightness

I wrote an API including a CLI program and a daemon to set the brightness of a display under Linux. The API is mainly represented by the class Backlight() and is ...
10
votes
1answer
6k views

Simple yet Hackable WhatsApp API [UNOFFICIAL]

There is no official WhatsApp API. Here is a simple python class which satisfies the need. ...
1
vote
0answers
35 views

Return two results from API with an ID set

I am calling from an API to return a member and their upcoming classes. I would like to show only the next two classes (up to six are available in the API) that have an ID set. ...
2
votes
1answer
263 views

Beginner Node.js app using Heroku w/ Mailchimp API

I'd like some feedback on the readability and style of the following code. It's a simple Node.js app that uses the Mailchimp API to add emails to a list. The client side handles SVGs, sign-up ...
4
votes
1answer
491 views

Python API for simple OpenCV image proc, called with JSON inputs

Background I've got OpenCV & Python installed on a Docker container which is on a http server to process images and serve them. The user interface is through the web; user inputs an image and ...
2
votes
2answers
2k views

Java API token expiration handler

I want to implement a utility class which manages tokens generated by any API. The idea is simple: It should store the current token value. The token should be initialized just before first use ...
1
vote
1answer
74 views

Aggregating clients and client types

The code I have put together achieves what I want, but I don't know if it is the right way to go about tackling the problem. I am dealing with 2 tables (CLIENT, CLIENTTYPE) each of which I have an ...
6
votes
1answer
297 views

Python API for Crimson Hexagon

I'd like some feedback on the readability, style, and potential problems or issues. In particular I'm not too happy with how I handle ratelimits. ...
2
votes
1answer
63 views

Small module for getting JSON to work with in Python

I currently have a module with Class / Methods I want to use in other scripts. Recently chess.com released a read-only REST API for beta-testing. The methods in my class build a URL for the API ...
3
votes
1answer
102 views

API Implementation and Architecture

I recently put together an Express/Node API that consumes and transforms an additional third party API. And while everything is working great, I feel there may be ways to improve the architecture ...
1
vote
0answers
46 views

Android continually run api request

What is the best practice to run continually api request, like every 1-10 seconds. Currently I am doing this which is not a good practice I think, it probably causes some overhead: ...
3
votes
1answer
786 views

Bulk Email notifications in Java?

I have written a service which uses the Java Mail Api to send bulk email notifications to the recipients. I feel that the way I implemented the solution is not really scalable when the number of ...
1
vote
1answer
180 views

Fetching and shortening URLs with API calls using Promises

I have a node module that accesses the News API to fetch news articles and runs each article's URL through Google's URL shortener. It also has a caching mechanism implemented. This was previously ...
1
vote
0answers
37 views

API separate request vs logic

Is it a good practice to separate Logic from Request controller in an Api ? Without separation: ...
0
votes
1answer
405 views

C# API Wrapper with Static Function Calls

I'm creating a wrapper library for an API, and I hit a block on how to redesign it. The entire library is static, and I'd like to change it to make it more testable. The library's goal is to make ...
3
votes
2answers
525 views

Implementing unified API data flow in ASP.NET Core

I have the API project on ASP.NET Core, and it's quite annoying always write methods like this: ...
8
votes
2answers
246 views

Trending Machine Learning topics for Alexa

I've created a small Flash Briefing Alexa skill that reports the top 5 trending topics in Machine Learning from the My Bridge service. The feed for the Flash Briefing skill can be pointed to an ...
3
votes
1answer
242 views

Standard primitive types vs custom structs in public API

I am writing a .NET library and have a lot of properties like this: public ??? SomeProperty { get; set; } where valid values are 0-15 (or from 00000000 to ...
3
votes
1answer
345 views

Simple Imgur API

I slowly made an Imgur client and everything works but I have few questions about how to make classes more OOP and cleaner. Is that correct to make generateToken ...
5
votes
1answer
1k views

Rails & RSpec - Testing API with request specs and shared examples

I have written the following shared examples which are used in multiple request specs to test a namespaced RESTful JSON API. Application details: Rails 4.2, RSpec 3.5, Devise for authentication and ...
3
votes
1answer
720 views

JSON Cache Program

I have some code that is intended to be a package (so that it can be accessed via import cachejson). Here is the code for the package: The update variable is ...
3
votes
0answers
40 views

oEmbed provider servlet to handle four media types

I would like to add oEmbed tags to my site (I'm the oEmbed api provider). My api should respond the results based on the file type. oEmbed Types has Photo Video Link Rich My response to photo ...
0
votes
1answer
46 views

Displaying API results inside a WordPress page template

I've created a WordPress page template that calls an API using Httpful and formats the results. This is my first time using APIs on a page, so I'd like to know if this is the right direction to go in. ...