I
I
Ibishka2020-08-07 16:11:30
RESTful API
Ibishka, 2020-08-07 16:11:30

How to pass array to url for Rest api?

I get a list of products by ajax GET to api.example.com/goods?page=1 and when filtering colors, how do I pass the id of the flowers to the url? So api.example.com/goods?page=1&colors=1,2,5 ???

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-08-07
@Ibishka

api.example.com/goods?page=1&colors[]=1&colors[]=2&colors[]=3

So the array of values ​​can be obtained immediately through But the option you proposed is also actively used. $_GET['colors']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question