Y
Y
Yarovoy Ivan2015-03-27 03:43:46
Django
Yarovoy Ivan, 2015-03-27 03:43:46

I am writing an application in Angular, how to solve the problem of not fulfilling API requests?

Hello, I am writing applications for ios on the ionic frame, which is also angular with a shell, and then there was such a problem that:
$http.get(' 127.0.0.1:8000/api/v1/order/?client=1&format=json ').
success(function(data) {
$scope.orders = data.objects;
}
)
fires and returns the data, but here:
$http.post(' 127.0.0.1:8000//api/v1/order ', {client: 1} ).
success(function(data) {
return data;
}
);
and other queries don't work. Help solve this problem.
The API is taken from django-tastypie.
POST request returns 404 :
[27/Mar/2015 01:07:15] "GET /api/v1/order/?client=1&format=json HTTP/1.1" 200 732
[27/Mar/2015 01:07:25 ] "POST //api/v1/order/ HTTP/1.1" 404 2047
4819559be13545ca993a8fe60b462d6d.png
3434ae049ce84737a7ccecfdef4b5607.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ramallah, 2015-03-27
@ramallah

Well so different requests are sent. in the first variant GET, and in the second POST.
API server routing may well not accept POST requests for this call, which is hinted at in the answer.
This can always be tested in some REST tester.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question