Questions tagged [http]

HyperText Transfer Protocol - a textual system for representing web requests and replies.

Filter by
Sorted by
Tagged with
5
votes
3answers
3k views

How to decide the granularity for RESTful APIs

Most of us know SOLID, and over the years have understood how useful it can get when we need to change. Based on S & I parts of SOLID and from experience I used to design my HTTP RESTful services ...
3
votes
2answers
3k views

REST Web API: What should be returned? NotImplemented, BadRequest or Bad Design?

Let's say I have an enumeration of related information types and an enumeration of time periods. Also I have created two operations on a controller for retrieving data of those info types. Due to ...
-2
votes
1answer
2k views

What is the diffence between HTTPListener and a webservice

Im using C# as my development language. However I have some confusion over HTTPListener and a web service. Can you please explain what are the differences and advantages and possibly a situation in ...
5
votes
1answer
3k views

REST API caching strategy for collection of records

I am designing a REST API for my mobile clients to interact with our app server (built with Django/django-rest-framework if it makes any difference). There are a number of different objects ...
1
vote
2answers
876 views

Microservices, browsers and HTTP requests

In the old days we used to create a single .gif file for the entire application to avoid too many trips from the browser to the server. Similarly, we used to combine different types of information in ...
8
votes
2answers
10k views

REST: How to determine transient exceptions?

As I try to deal with the possibility of failure when I invoke RESTful endpoints or in general any HTTP endpoint I've been wondering if there is any standard or pattern in the HTTP specification or in ...
8
votes
1answer
324 views

What is (full) semantic transparency?

I was reading the RFC 2616 regarding HTTP/1.1 when this term came up: Therefore, the HTTP/1.1 protocol provides these important elements: [...] Protocol features that provide full semantic ...
3
votes
4answers
737 views

How to design HTTP endpoint which search for single resource instance and returns it with another, connected instance

I have an endpoint returning single-element collection (I didn't return just object-instance to keep consistent with resource-as-collection convention, so only get-by-id returns single instance) GET ...
18
votes
1answer
14k views

RESTful API and i18n: how to design the response?

We are designing a RESTful API that is mainly intended to meet the needs of a single client. Because of its very particular circumstances, this client has to make as few requests as possible. The ...
4
votes
3answers
702 views

Options for the RESTFul approach for follow and unfollowing

I'm looking at implementing a new RESTFul call where a User can follow/unfollow a generic 'thing' item, but I need to know the best or common approach below, 1 or 2? 1) A GET or POST on the ...
18
votes
3answers
28k views

Handling token renewal / session expiration in a RESTful API

I'm building a RESTful API that uses JWT tokens for user authentication (issued by a login endpoint and sent in all headers afterwards), and the tokens need to be refreshed after a fixed amount of ...
5
votes
1answer
888 views

Should an API strip whitespace in user content?

Let’s say there is a REST API which allows users to create objects. These objects have a name. The name doesn’t need to be unique among all objects and doesn’t have any special meaning within the API. ...
0
votes
1answer
89 views

Is it relevant to use Http Error Code within my "Application"

Is it acceptable to use Http status codes (.NET HttpStatusCode enum) in my application instead of creating a new enum ? I encoutered an issue (design issue?) in my API, for example in the ...
-1
votes
1answer
123 views

How to explain to a trainee how a computer receives external messages [closed]

I got a trainee in the company I work for. We are currently working on a JS interface that communicates through websocket with a C/Lang server. My trainee asked me a very good question this morning. ...
4
votes
2answers
653 views

Returning HTTP 304 Unmodified (without server-side caching)

In HTTP 1.1, a web server could return a 304 Unmodified response when a If-None-Match header is included in the GET request. For REST API, I've only seen implementations involving server-side caching ...
6
votes
3answers
11k views

REST Webservices (post / put) : which type of parameter should I choose, and when?

On a POST (or PUT) webservice, I know can use three different type of parameters, I can send my parameters in the path of the URL /objects/{path_param}, after a question mark in the URL /objects?{...
1
vote
3answers
2k views

Is there an industry-standard equivalent to cURL?

A bit of background information: I'd been a Java developer for a company for about 6 years. This company used a variety of Linux-based operating systems for its day-to-day operations; all of our ...
2
votes
0answers
111 views

Why do RFCs use the term 'HTTP protocol'? [closed]

Several RFCs use the term 'HTTP protocol' (example). However, the acronym 'HTTP' already includes the word 'protocol' in it. Hence, isn't it redundant (and hence incorrect) to use 'HTTP protocol', ...
81
votes
8answers
48k views

What HTTP status code to return if multiple actions finish with different statuses?

I am building an API where the user can ask the server to perform multiple actions in one HTTP request. The result is returned as a JSON array, with one entry per action. Each of these actions might ...
106
votes
5answers
68k views

Should I return an HTTP 400 (Bad Request) status if a parameter is syntactically correct, but violates a business rule?

Say that I have a REST endpoint that takes an integer as a parameter: /makeWaffles?numberOfWaffles=3 In this case, I want the number to be positive because I can't make a negative number of waffles (...
-1
votes
1answer
346 views

How can I translate an ip address to a url in a Java Webserver?

I host my own webserver through Java. The problem is I can only access it through a web browser by using an ip address. Can I spoof a url? For example, I type in 192.168.2.111 into the address bar,...
1
vote
2answers
1k views

Is it safe to say that AJAX is a particular way of using HTTP?

I really need someone to confirm the following, and if necessary help me filter what I have read so far. AJAX, which stands for Asynchronous JavaScript and XML, is used to exchange data and is a form ...
0
votes
1answer
126 views

REST API with optional resource creation

I have a web app with JavaScript front-end which communicates with back-end via REST API (AJAX calls). Front-end have a Sign Up page. When user decides to register, front-end makes REST call to ...
0
votes
1answer
137 views

Is it possible to download a section of a HTML file programmatically?

Can one define a section of an HTML webpage to download (typically using HTTP), instead of the whole file, and utilize this in a program to save bandwidth? For example, in C# (but I guess the language ...
2
votes
2answers
6k views

What API design makes the most sense for changing a user's password?

Consider a web page where a user changes his password after clicking on an emailed password reset link. The page will be implemented against an API using ajax, rather than as an ordinary form ...
-1
votes
1answer
5k views

How to send a http request through a program developed in C? [closed]

As you read in the title, for example, i wanna login to my account in StackOverflow by sending the E-mail and password through a program developed in c language, so all what i have to do is to enter ...
1
vote
1answer
3k views

How to deal with automatic binding exceptions with Jersey?

It's really nice to have automatic binding with Jersey-Jackson (well, I believe it's actually MOXy the one who manages the bindings), so object serialization and deserialization is done under the hood....
25
votes
3answers
57k views

Should I return a 204 or a 404 response when a resource is not found?

I am developing a simple RESTful service for tournaments and schedules. When a tournament is created through a POST request containing a JSON body, the tournament is inserted in a BiMap, declared as ...
2
votes
1answer
6k views

What are the benefits of Asynchronous HTTP

Q.1 I know that when we are talking about synchronous HTTP, for each request a Thread may be spawn and get blocked, so when number of simultaneous connections increase, we will encounter massive ...
5
votes
2answers
201 views

REST server user authentication

So i am creating my first larger scale application (by larger scale i mean something i see myself publishing in the app store) and i am not sure of how to handle user authorization. The client will ...
6
votes
2answers
5k views

Is it correct to use PUT with multipart content?

We are using Spring and want to implement a REST with a "override file" call so we think using PUT verb with a multipart body only to find that Spring don't accept it. My question is it can't be done ...
1
vote
3answers
355 views

Best Communication strategy for monitoring dashboard

I have a requirement where I need to display certain stats on Admin Dashboard in my web application (Angular+Java). These stats (transnational data) are being generated on different servers (connected ...
6
votes
1answer
326 views

REST API - What HTTP code should be returned when resource is not in a state required to complete the operation?

Our API accepts PUT requests in order to change status of resources. Think of this as a state machine. Client can specify the target state of the resource via PUT request but it is possible that the ...
71
votes
4answers
50k views

HTTP Status Code for "Still Processing"

I'm building a RESTful API that supports queuing long-running tasks for eventual handling. The typical workflow for this API would be: User fills in form Client posts data to API API returns 202 ...
85
votes
8answers
131k views

RESTful API. Should I be returning the object that was created / updated?

I'm designing a RESTful web service using WebApi and was wondering what HTTP responses and response bodies to return when updating / creating objects. For example I can use the POST method to send ...
2
votes
2answers
2k views

Publish / Subscribe via HTTP Callbacks?

My team is tasked with creating a publish/subscribe system for incoming REST messages. 99% of the time, this system will be used for notifications between different processes on the same cpu, but we ...
0
votes
1answer
163 views

What is the importance of WS-Addressing in SOAP?

I'm learning Web Services Addressing and SOAP, but I can't get the importance of WS-Addressing in SOAP. This is quoted from Wikipedia "standardized way of including message routing data within SOAP ...
2
votes
1answer
958 views

Is it acceptable for user agents to modify cookies other than by instruction from the server?

Using javascript or in a native iOS App it is possible to read and modify cookies. The server generally sets these, but if both the server and the client modifies the values then it becomes a global ...
1
vote
2answers
142 views

Secure authentication using JWT

I read about JWT and how they can provide secure authentication for calling api routes over http. I naively implemented it and here is how it goes : a client posts username and password to a login ...
3
votes
2answers
244 views

How are POST/PUT/DELETE data passed to APIs?

I know that the data is passed through HTTP, but I'm not sure if I should be passing data through HTTP headers, or HTTP bodies. Which one is the convention for APIs? Also, theoretically using PHP, ...
10
votes
3answers
2k views

Microservices and isolated data storage models [duplicate]

I have been looking at Microservices for a while now. The concept is not new but it's communicated in a lightweight manner. So, I am very excited about this. However, there is a question that I am ...
72
votes
4answers
19k views

Should I use HTTP status codes to describe application level events

Several servers I have dealt with will return HTTP 200 for requests that the client ought to consider a failure, with something like 'success : false' in the body. This does not seem like a proper ...
2
votes
1answer
1k views

What encoding are the HTTP status and header lines?

If I was going to write a parser for HTTP, would I be able to assume the encoding of the HTTP headers and status line? Until I read the charset or encoding header, how could I tell what the encoding ...
0
votes
2answers
130 views

Should my public webservices use HTTP or HTTPS?

The situation is a bit more complex than the title suggests (but not much). I'm working on a REST API that will have a few open / publicly available resources and a few with authentication. (The ...
3
votes
1answer
2k views

Load testing HTTP server with large number of concurrent connections

I'm trying to load test/benchmark a http server with a very large number of simultaneous connections (10-100k). What is a good procedure for doing this? On linux I've seen that both the client and ...
0
votes
1answer
246 views

Where should I log in the user based on http session: service or controller?

I know that best practice is to let everything about authentication/authorization to the service layer. Controller should not be aware of that. But how to let a service (from service layer so) to ...
2
votes
1answer
794 views

What mechanism/protocol transmits non-HTML files when downloaded from the web?

When a non-HTML file such as a PDF, DOCX, EXE, etc is made public to the WWW by an HTTP server, and a client makes a request for said file, www.example.com/download?=test.doc what facilitates the ...
3
votes
3answers
2k views

Image resolution in a RESTful interface

Background I have a RESTful HTTP API. I have a resource. GET /my/cat HTTP/1.1 Clients may want to retrieve the image representation of this resource. GET /my/cat HTTP/1.1 Accepts: image/png ...
1
vote
3answers
870 views

Would it be possible to transfer an HTML file using a protocol different from HTTP?

I am reading about internet and stuff and just learned that web pages are really just HTML files. Also, I have learned that HTTP is just a transfer protocol. So my question is, would it be possible ...
0
votes
1answer
666 views

Should http requests be in the constructor or in a static function? [closed]

Which is conventional? For example, this is in the constructor: public class Foo { ... public Foo(...) { // http requests } ... } and this is in the static method: public class Foo {...

1 2 3
4
5
8