Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [api]

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

3
votes
1answer
75 views

API for multiple printer attributes [on hold]

I have network printers which have different attributes (e.g. supported network protocols, languages, status, print modes). ...
6
votes
2answers
111 views
+50

Snake Game with own Field API

Some days ago, I posted a question here: Field class as basis for a role playing game I payed respect to tips I find useful and made a further development of my Field-classes. These classes have to ...
1
vote
1answer
62 views

Script to get available IP automatically

Recently I made a script to get available IP automatically. I was woundering if anyone can give me tips on how to make this code look better, preferably in a class and OOP. I'm gonna show the code to ...
2
votes
0answers
18 views

WordPress rest api basic auth with IP check

I'd like to use basic auth with the WordPress API, but restrict the capability to a single IP address. I've updated the existing code from here: https://github.com/WP-API/Basic-Auth accordingly. It ...
3
votes
0answers
51 views

User registration in Actix w/ DynamoDB

I am trying to puzzle out api based user registration for a service I am building, but I have a strong feeling that my code is not optimal. It feels like passing "state" in the way I did prevents the ...
9
votes
1answer
120 views

Flight API querier

I am learning Go and wrote a small application that queries the Skyscanner API as my first attempt at learning. I was hoping someone more expert than me in the language could look over it at broad ...
5
votes
2answers
115 views

CloudFlare Dynamic DNS Update Script in Python 3

I have a computer that roams, but needs to have an FQDN attached to it for certain reasons such as email system integrations or testing email via a testing SMTP server that requires valid FQDNs and ...
1
vote
0answers
28 views

Temporarily block API calls when server sends a 503 response

I have a scenario in which I call many APIs throughout my application lifecycle. In case the server sends me a 503 response code, it will also send a lockdown object which has a timestamp associated ...
4
votes
1answer
61 views

Filter by multiple options - also only if not empty

Here's how my json looks like. I'm trying to write a function which filters based on participantCriteria.criteriaType & participantCriteria._id ...
1
vote
1answer
1k views

Java API token expiration handler

I want to implement a utility class which manage 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 ...
7
votes
1answer
50 views

ArXiV Technical Paper API Github Repo

My name is Ethan and I am trying to build an API for scaping technical papers to use for developers. Right now it only works for ArXiV but I would greatly appreciate some mentoring or a code review of ...
5
votes
2answers
94 views

Avoiding code repeating in RESTful APIS PHP

Since my last question related to this I have managed to create a working base and to understand how MVC works. I'm writing RESTful APIS in PHP, they serve the purpose but I see that my code is ...
2
votes
1answer
1k views

Node.js/Express middleware to relay requests to various APIs

I am creating a nodejs middleware server that will handle api transactions from a frontend and relay them to various api's (internal and external). The primary goal is to hide api keys from the ...
1
vote
0answers
18 views

Requests / Facebook API - Dealing with Errors

I work in marketing and I am currently trying to aggregate data for 50 facebook pages on the same Business Page. I have a loop ...
5
votes
1answer
967 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 ...
5
votes
1answer
777 views

Django Rest Framework Totaling API values in different ways

I am working on a stats website for my softball teams that I manage/play for. Here is my current Stat model: ...
5
votes
1answer
54 views

C++ API for reading RIFF files

I wrote a simple library for reading RIFF-encoded files in C++. I tried to adhere to modern practices and provide an idiomatic API, but there is one part that sticks like a sore thumb to me: the way ...
3
votes
2answers
75 views

Use weather API to get information in JavaScript + jQuery

Please can any code experts review and improve my code? HTML ...
3
votes
1answer
124 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 ...
0
votes
1answer
125 views

Displaying the value of a stock portfolio

Some people have mentioned to me that my site is quite inefficient and given that it's taking ~17secs to load now, I'd like to change that but I've no idea how. I've tried Gzip to compress it but it ...
3
votes
2answers
128 views

PHP script that writes a JSON file with iextrading API data

iextrading has two APIs (v1, v2) which provide financial market data. Following script records a JSON file with their equity information (using a CRON job). Would you be kind and review it for any ...
1
vote
0answers
52 views

Implement versioning of a RESTful API with PHP/Slim and Apache

I want to create a RESTful API with Apache/PHP and the Slim Framework (3.x). The API should support URI-based versioning like ...
12
votes
1answer
656 views

Script to load the ISS location and data

I wrote a script to fetch the location for the ISS using two simple API's. This is my first time writing a python script. Any advice or modifications would be highly appreciated. How is the code ...
-1
votes
1answer
79 views

Read JSON files, basic calculations and write over another JSON file

Class SectorController calculates weight coefficients for sector performances in equity exchange markets using minute data from an API (for instance, if a group of ...
1
vote
0answers
26 views

Password Checker using Pwnedpasswords API in Rust

This takes a user password, hashes password to SHA1 and does a check against the Pwnedpasswords database. I know I need to use unwrap less and do more real checking to improve the clarity of errors. ...
0
votes
0answers
51 views

Gmail API list messages NodeJS

I use the following code to list and trash messages from the Gmail API in NodeJS. I call the getAllMessages method to get all email bodies because the Gmail API ...
1
vote
1answer
75 views

Laravel show and update currency from rest api

I need: Daily save new exchange rates from the REST API in the database. Return the current exchange rate for a given currency, the whole table for a given day, the exchange rate for a given currency ...
3
votes
1answer
78 views

Google Custom Search placeholder function in JavaScript

Problem: We have a Google Custom Search function that replaces the input placeholder attribute and it works okay. Would you be so kind and help me with reviewing ...
-1
votes
1answer
51 views

C++ API design - Should I pass enums as method parameters

I have two methods which are GetMinimumSize() and GetMaximumSize(). They return the maximum size of the window, and they take ...
1
vote
0answers
44 views

See if a specific resource exists in a Kubernetes namespace

I want to have a function that checks to see if a certain resource (deployment, job, cronjob etc) exist in a namespace. Using the Kubernetes Python client, I can create a boolean function (using ...
2
votes
1answer
29 views

RESTful API echo server using Python bottles

I just wrote an echo server that responds to curl requests with the method used and the data sent. Sticking to GET and POST for now, but I would like to know if there's something I can do to improve ...
2
votes
0answers
69 views

PHP project with Google Calendar API

I'm playing with a simple (for now) project in PHP with Google Calendar API. I have posted the code here in order to improve my programming style about whatever you think it's worth suggesting. Thank ...
5
votes
0answers
50 views

Finding unimplemented tasks on Rosetta Code using Requests

This is a Find unimplemented tasks task from Rosetta Code: Given the name of a language on Rosetta Code, find all tasks which are not implemented in that language. There is already a solution ...
4
votes
1answer
56 views

DigitalOcean dynamic DNS update script

Inspired by a shell script I saw on Github, I put together a Python version to update the dynamic IP address for a subdomain I have that uses DigitalOcean's nameservers. I added a check to see if the ...
1
vote
0answers
23 views

API Client: Querying data out of an endpoint

I have a simple piece of code which connects to an API, does a request and gets back the raw data. After getting this data I create several objects (models) and persist them into a MongoDB database. ...
5
votes
1answer
63 views

NHL Stats web app

There is a web app. My first attempt to use NHL API have been reviewed here. I'm interested in any kind of refactoring of this code. But I have some questions that I want to point at specifically. ...
1
vote
2answers
207 views

Retrieve data from eBird API and create multi-level hierarchy of locations

As you may know, I like birds. The Cornell Lab of Ornithology has a tool called eBird where you can submit records of the birds you identified. I recently learned they have an API that I can query, ...
2
votes
1answer
78 views

Offset vs Cursor Pagination

I am trying to compare any performance gain(s) from moving a current offset-based pagination endpoint to a cursor based one. I have the following ruby code: ...
4
votes
2answers
82 views

GitHub repo tree generator

I have built a generator that, using the GitHub API, creates a dictionary containing a tree of all the resources in any GitHub repo. It uses the function git_tree, ...
2
votes
0answers
146 views

Wrapping a web scraper in a RESTful API

The problem I am looking to solve is wrapping a web scraper in a RESTful API such that it can be called programmatically from another application, frontend or microservice. The overall goal is that ...
1
vote
0answers
44 views

TDD for Ruby On Rails API for group event items

I found myself working in this coding exercise for a work offer. I tried to apply TDD in the process but I didn't get any feedback from the company and I really would like to know what can be improved ...
3
votes
0answers
61 views

One interface for multiple CRUD resources

I asked about an abstraction layer for accessing files (link) a couple of days ago (I decided to not call it a follow-up anymore as there are too many changes). I tried to incorporate many of the ...
6
votes
1answer
80 views

Spotify current track to vk.com user's status

This is refactored and much more expanded version of the script reviewed here. The whole authorization process is added. ...
6
votes
1answer
173 views

API for SQLConnect Library

I've designed a library for connecting Objective-C (and now Swift) apps to Microsoft SQL Server 2005+. (I believe there are other databases it works with, but I've only tested with MSSQL.) The ...
3
votes
1answer
88 views

Use Python along with the HubSpot HubDB API and the Blog Post API to create, update, and publish a batch of blog posts

My program automates the process of creating and publishing 152 blog posts quarterly. The blogging platform HubSpot has a series of APIs that allow developers to access account data from a CLI in ...
2
votes
1answer
89 views

Spotify API data to vk.com user's status

Just a simple script that puts a user's currently playing track(on Spotify) to his account's status on vk.com. And printing info about the track in the console. ...
7
votes
2answers
261 views

Translating LaTeX documents into different languages using DeepL API

I'm coming from C and C++ and have often troubles using Python's full potential. This is a script I wrote to translate LaTeX documents into different languages. A parser replaces all latex specific ...
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'...
3
votes
1answer
65 views

Command-line NHL skaters stats tool

Have been playing with the undocumented NHL API for some days. I'd love to see any input about this little script. About overall structure, style, performance enhancements, etc. Not sure how to ...
7
votes
2answers
327 views

Getting current weather data using OpenWeatherMap API

I would really appreciate if someone could take a look at this code. I am not very advanced, so ANY kind of feedback and critique would be precious to me. What this program is supposed to do is to go ...