Questions tagged [url]
51 questions
49
votes
2 answers
REST API Design: Multiple calls vs. single call to the API
We are developing a Rest API for eCommerce website which will be consumed by mobile apps.
In the home page of an app we need to call multiple resources like Sliders, Top Brands, Best Selling Products, Trending Products etc.
Two options to make API…

Shaiju T
- 601
- 1
- 5
- 10
25
votes
2 answers
Levels of user permissions in a RESTful API
Let's say I have a company that ranks the cutest cats on the internet.
I offer a resource at /cats/ which provides users with the latest, cutest adorable cats.
Users can either get just the top 3 cats if they haven't paid at all or registered. The…

Benjamin Gruenbaum
- 5,157
- 4
- 24
- 34
16
votes
2 answers
Should I specify the userId in the REST URL structure?
Basically, one feature of my app is to retrieve the logged user's friends.
Actually, I hesitate between both kind of endpoints:
GET /api/users/friends
GET /api/users/:userId/friends
Using 1, userId would be reachable through the authentication…

Mik378
- 3,838
- 7
- 33
- 60
8
votes
2 answers
Should I configure my URLs with a leading and/or trailing slash?
Maybe too basic of a question but wanted to see if there is more to it than I am thinking.
When configuring URLs (baseUrls, like https://my.app or relative URLs like /path/to/resource) either as a static variable, in configuration files or…

c_maker
- 8,250
- 4
- 35
- 53
7
votes
1 answer
When passing dates/datetimes as url parameters in an API, which format is better - unix timestamp or date string (ISO 8601)
Interesting question came up at work in regards to the better format of passing a date/datetime as a url parameter in an API: Is it better to pass as a unix timestamp, or as a plaintext date string (01/30/2015 04:17:57pm, 2015-01-27T16:17:57+00:00)?

jsanc623
- 179
- 1
- 1
- 6
6
votes
3 answers
How to deal with long URLs in comments that exceed the 80 characters limit?
I generally try to adhere to the 80 character limit for each line of code to satisfy my colleagues, to satisfy the linting tools, and to maintain an image of professionalism when random people look at my code.
However, sometimes I have URLs that I…

Flux
- 171
- 1
- 5
6
votes
2 answers
What is the correct way to pass JSON objects in an http request when a GET request is most appropriate?
One scenario is when you're creating a search endpoint. In the example below, I want to search a database of companies and the queries can become complicated; enough where I want to have the parameters passed as JSON objects instead of a flat…

Cuthbert
- 201
- 1
- 2
- 9
6
votes
5 answers
When did the first "REST"-model and friendly URL web technology come to be?
Everyone knows that the "current" way to do things is to have user-readable URLs. Like:
http://example.com/blog/edit/1234
Rather than:
http://example.com/blog.php?action=edit&id=1234
When exactly did people start making web technologies handling…

Earlz
- 22,658
- 7
- 46
- 60
5
votes
3 answers
REST API Design: Should the update (PUT) request include the ID in the resource URL?
When designing a REST API for update request. Usually PUT is used. Question: should the resource URL include the id usually?
For instance, there is a book resource: http://localhost:8080/library/book
When updating a given book with Id, say 123, we…

Rui
- 1,569
- 1
- 11
- 18
5
votes
2 answers
Should ID be given in URL if already secured with JWT containing ID?
Say I have the endpoints:
/users
and
/users/
If I wanted to DELETE a user authenticated with a JWT token that contains the user object, should this DELETE handled go under /users or /users/?
It makes sense to have under the /users/…

tomhepz
- 331
- 1
- 6
5
votes
2 answers
Using double dot notation in URL link
I've recently been working on a project and I've been seeing two different forms of url's being used.
src="../MyLinkUrl"
and
src="/MyLinkUrl"
We are using MVC .NET and the times I have seen the .. usages have been in Javascript code files and not…

dreza
- 3,466
- 4
- 32
- 39
5
votes
5 answers
Best way to protect website application code
Background
I have a web application that I host on my own server. I have clients who use the application as is, but some have asked if they can host the application on their own server. This enables them to have their own URLS rather than mine. The…

GWed
- 3,085
- 5
- 26
- 43
4
votes
0 answers
Is there a conventional URI scheme for local sockets (AF_UNIX)?
I'm looking at creating a class which accepts a string to define a Unix socket address.
Linux supports three types of addresses for Unix sockets:
File based addresses (also called named domain addresses)
Abstract addresses
Unnamed addresses
The…

Alexis Wilke
- 241
- 1
- 7
4
votes
2 answers
Should a web application be aware of its URL, including its sub-directory?
Let's say I have a reverse proxy set up getting traffic at http://gluten-free-snacks.example.com. It serves different URLs by sub-directories, not sub-domains, for a better web UX.
Its default behavior is to route all requests to a WordPress site…

Eric
- 207
- 1
- 7
4
votes
1 answer
Different operators in query string like ?var!=value
This one may actually be 2 questions in one.
Studying some APIs I came across an api suggesting to have operand different from equal (=) inside the query string…

Aslabs
- 163
- 1
- 1
- 4