Api connector guidelines(not creating a API) - json

I started using Laravel around a year ago and I am currently making an application where I have to transfter data between multiple REST JSON API's.
I can find a lot of articles how to create API's. However I can't really find any information how to practicly connect to API's and using them in an object orientated way inside Laravel.
I'm thinking about using a model approach combined with interfaces to keep track of API version changes. I want to use repositories to make the API call. Inside this repositories i will use restable method names(e.g. GET,PATCH,POST,DELETE).
I am not sure this is a best practice and I understand this is a question where people can have a lot of opinions about.
If someone can give me some basic guidelines or starting points it would be greatly appriciated.

Related

Package giving Incremental search using Swift backend on Website

I am looking for a package that can be included or adapted to allow a website to communicate with a Swift backend.
What I want is be able to place a text field on a website that functions like the main google search box and works communicating with a Swift backend returning the results.
I am asking for help finding a framework that I can adapt to my needs.
Need help forming a reasonable set of queries to find the software I need.

Implement a http server with RESTful http API

I've started to learn backend development, focus on http server mainly.
But I'm really new to this, so it's a little out of focus for me, and I could really use some advice.
For example, if I try to implement something like this
A http server runs on linux/Windows
A private REST API which allows to POST a json object, plus a login mechanism, so only authorised user can do the POST.
Implement a public REST API which allows to GET the same json object
And here is my question:
Can I use Nodejs and express to implement all these? I also know little about them.
Do I need a Database to implement the login mechanism?
Is there any similar tutorial or best practise I can study from?
Regards
Ben
Yes, you can use NodeJS for this.
Not necessarily. You just need a way to authorise users. Most common is to use a database to store a username/email and password, but you could also look into using a third-party service for this, for example facebook or google
Yes, there is a lot of tutorials and especially best practices on this subject. Your question is too broad to link relevant material, but some terms you can use to google this yourself is "nodejs rest api" "rest api best practice". Passport.js is a good place to start for getting into authorising users. For REST-api, the closer you get to normal web standards, the better - Especially if other people than you are going to consume the api.
Node.js is a run-time environment/framework/platform for developing non-blocking I/O server side processes, services, or RESTful API's. You can start by learning what Node.js can do before you go on developing a login story and, and a restful endpoint here
Next if you intend to go all the way and learn full-stack web development start from here, This will guide you to learn Node.js , Express.js, Mongodb, and finally Angular.js for front-end. Good luck and happy coding
Yes, you can use Node.js and Express.js. I recomend you to read some articles about REST and TDD from this amazing blog, especialy this or this.

Which technologies are advised to use for developing the following project?

Two years ago I developed an admin panel using winFroms that is used to configure different settings for specific users, create/remove users etc. This information is retrieved and saved to a SQL Database server.
I want to make this panel accessible through web browsers. I already have a REST API that will communicate with the database.
My question is: which technologies are the best to make this panel?
I've come across WebForms, MVC, HTML with Angular, jQuery etc., or with SPA.
I would appreciate it if someone can enlighten me with this matter. I know its not really a specific programmatic question, but there are so many different approaches that is difficult to find the right or best way.
I guess you already know a lot of .NET so if I was you I would just use a WebForms or MVC project and then call some jQuery on the api to handle the CRUD operations. But if you wanna try something completely new then use Angular.

Interface for databasing tweets?

I have just started a new project and step one is to go and collect a bunch of information. For this first step I need a script that takes a twitter username. The program will then grab the last five posts from the user, and place them into a database, preferably as a JSON file.
I have been looking into Twitter4J, and the Streaming API. While I feel these are both good resources that are very robust and contain a lot of functionality. I am struggling to find anything that just gives me a simple start. Ideally a step by step, get one post as text, kind of tutorial would be ideal, and then I can dive into the docs and find the modules I need and so on.
So is there any tutorials or lightweight frameworks that one may know of? I am open to any language, and any suggestions. Thanks in advance, and for taking the time to read through this!
TL;DR. Need a lightweight framework that handles twitter, or a link a beginner Twitter API tutorial.
If your interested in a good PHP framework and want an easier way to work with the Streaming API, I would highly recommend looking at the 140 server. It's a framework to start with rather then to integrate later, and it looks like your just starting out so it may be a good choice. Using the streaming API you can open up a firehose with your queries and items will be pushed to you. This definitely looks to be the right choice for your use case.
Also, since you now have the link to the server, take a look through the rest of this site. I don't think you'll find a better resource for Twitter tutorials and resources.
If your looking for something much simpler, and want to get your feet wet from the beginning with Twitter and if you've never worked with RESTful API's, take an additional look at the following.
Here is an article about integrating RESTful services with CI. Codeigniter is a nice PHP framework to start with and has a lot of resourceful documentation, The example they use in the tutorial is actually Twitter which is nice.
http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/
Here is a more general article about the Twitter RESTful API
http://www.ibm.com/developerworks/xml/library/x-twitterREST/
and finally if your going with CI, have a look at this library that will make things that much easier. Especially if your working with oAuth and such. It basically abstracts the whole twitter API (less streaming) into easy to use CI calls.
. . and if you don't want to use the streaming API, for your use case, your going to want to cache the tweets. I don't know any specifically great articles for this, but it's a pretty popular method and should be easy to search for. You do this because the API is rate limited in most cases.

Is this an appropriate occasion to use ruby on rails?

I want to create a RESTful API for a website which will collect/insert/delete data from a MySQL db. Would Ruby on Rails (RoR) be an appropriate place to do this?
I haven't used it before, and this is why I wanted to check to see if this is an appropriate occasion or not.
Is it just the API?
I would use Sinatra for that. It will give you more flexibility and speed than a RoR app.
http://www.sinatrarb.com/
You can read the book Service-Oriented Design with Ruby and Rails, by Paul Dix. It gives you good overview about this topic.
If your API will have only one or two resources and a few CRUD actions, it will be faster implemented in Sinatra, but if your API will have more than two different resources, I would definitely use Rails, because of its strict MVC model and because you can split your code into different controllers/models and so on.
Sinatra can do the same, but it's more work and Rails does already a lot of work for you. In Rails 3 for example it's one line, and your app will already respond to json or xml.