3

I am doing a project which uses httpie. I was able to send primitive fields and it's array as a request query parameter. For example, say i have variable named "age" which is integer type, i can send this variable as a Query parameter, Form parameter, or Path parameter. If i want to send the age as a Query parameter, i would write the following:

http -v -f POST 'localhost:8080/api/v1/public/users?age=20'

The problem is when i want to send an object of non-primitive class. For example, i have a class named Name which is following:

public class Name {
  String first, middle, last;
}

Now for an object of this class how can i send an object of Name class as a parameter in httpie request. I tried a lot but didn't find any solution.

  • Example of the data you're trying to send would be helpful. – Jakub Roztocil May 07 '15 at 22:42
  • class Name { String first, middle, last}. now my command is similar to http -v -f POST 'http://localhost:8080/api/v1/public/users'. It's easy to send string, int parameters. but don't know how to send custom objects like object of Name class with the above command. – parina kisui May 08 '15 at 03:12
  • I'm not really sure what you're working on, but JSON doesn't support custom classes. Do you need to send the code snippet with the class definition as a string, or? – Jakub Roztocil May 08 '15 at 15:38

0 Answers0