I would implement HTTP Content Negotiation using the same API
2025-11-10 17:06:59
117
Danilo Souza :
I would return json during the night and xml during the daytime
2025-11-13 01:40:26
392
Caelumblade :
adapter design pattern
2025-11-12 21:04:22
1
aliased :
Wacha nisome comments
2025-11-10 17:15:23
5
George_patricks :
am stuck 😅 print ("hello world")
2025-11-11 17:48:13
1
Neon Jeff :
Query params or via the accept headers from the request
2025-11-11 19:47:23
3
Orbit_flight :
I never would have known this.
2025-11-11 14:50:05
2
m.moses :
you can create like different variables that defines the output and then use the if else statement to specify the return type. idk if it will work 😕
2025-11-10 18:02:28
2
snoopy :
Add a parm filter for xml or json
2025-11-10 21:07:08
2
💚 :
Depends, how much am I getting paid?
2025-11-12 11:56:08
1
Lucky Luuke :
I would return 404 and ask double my rate to fix the issue
2025-11-12 11:52:15
3
Gani :
Accept headers, then create a factory that can use instance base on the headers either is json or xml. implement a interface on the class that support json and xml. so in your factory class just need to list those class with different formats. just 1 endpoint but returns a response base on the headers.
2025-11-12 03:40:46
2
Rootech IT Solutions :
Just pass response type
2025-11-10 21:42:03
2
ASD :
I can use the request headers to determine the response data.
2025-11-12 13:09:44
1
Auth0_master :
Accept header in the req
2025-11-10 21:37:35
2
_tech_tip♊ :
mmm
2025-11-11 19:17:46
1
👆👉OLUWASEUN👈☝️ :
just diff your parameters and negotiate,
well, it also varies depending on datas too
2025-11-12 21:40:25
1
Mawuli Agbenyo 🇬🇭🇬🇭 :
Simple conditional return
2025-11-11 17:40:05
1
Br1.4.n :
I never used XML before 😂
2025-11-11 13:12:56
1
anonyxbiz :
The client can specify the format they want in the request, either in the headers or whatever. There are many ways to solve that, though using the Accept request header is the standard for browser clients.
2025-11-11 01:53:52
1
Cass Will53 :
hmm I see that the accept header is the correct way to do it but wat if the function that gives the product detail does so in son format
2025-11-11 16:19:53
2
ceejay_original :
content negotiation.
2025-11-11 13:21:28
1
Hassaam mehtab :
we can also use params for that
2025-11-12 14:05:58
1
B̷͎̠̪͔̤̐̄́ǒ̷̳͔͙̪̅̀͛b̷͔̠͚͑̈́ :
just add format as a query param
2025-11-11 23:27:04
1
To see more videos from user @gtechsailors, please go to the Tikwm
homepage.