0

I am working with some code originally written by someone else, using the Symfony2 framework to create routes in the form:

http://my_site.com/account/add
http://my_site.com/account/delete, etc.

The problem is that if I have something like this:

http://my_site.com/account/add/{"account_id":"test","web_site":"http://www.another_site.com"}

I am urlencoding the JSON string before sending it, but I am getting a 404 (route not found)

if I remove the http:// it works fine

Even if I do something like:

http://my_site.com/account/add/{"account_id":"test","web_site":"www.another_site.com/funstuff"}

I also get a 404 , with a message about route not found, which I assume comes from the symfony2 framework. Any ideas?

1
  • What does your router look like for this? Any requirements? Typically Resources/config/routing.yml... Passing all that garbage through the url seems crazy anyways... Commented Nov 16, 2012 at 20:46

2 Answers 2

3

I'm going to take a guess here and suggest trying to send the JSON via POST inside the body of the request. I've never seen something that requires putting JSON in a URL.

Sign up to request clarification or add additional context in comments.

2 Comments

+1 for recognizing a RESTful pattern when you see one. I'm in agreement on this.
Yes, it is a RESTful pattern, but post aside, the framework should be able to handle a get. I don't want to mess with the Router function of the framework (not that I understand it enough to be able to do that at this point). I will try a post
0

why are you passing as GET and not a POST. post generally used when data is sent to server causing data on the server to change.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.