mazzaa
November 24, 2021, 3:20pm
1
Hi there,
I am having some trouble creating a Task via the api, the route /api/v1/tasks/create gives back a empty json with only a user_id and the rest empty even the id.
in the headers i send
X-Api-Token : my-token-
X-Requested-With : XmlHtppRequest
thnx in advanced.
hillel
November 24, 2021, 3:21pm
2
Hi,
Have you been able to create other entity types?
mazzaa
November 24, 2021, 3:38pm
3
Hi,
I just tried the clients and credits, this results in the same behavior.
I get a an empty json object with only the user_id
any idea ?
hillel
November 24, 2021, 3:59pm
4
Can you share a sample curl request?
mazzaa
November 24, 2021, 4:21pm
5
Here it is, nothing fancy
curl -XGET -H ‘X-Api-Token: MYTOKEN’ -H ‘X-Requested-With: XMLHttpRequest’ ‘https://invoice.iftcontrol.com/api/v1/tasks/create ’
( have taken out the real API token)
hillel
November 24, 2021, 5:20pm
6
You would need to send a POST request to create a new record
mazzaa
November 24, 2021, 5:45pm
7
Thank you for the fast response.
But…
as the documentation states Build, Collaborate & Integrate APIs | SwaggerHub
it’s a GET .
With a POST i receive a 404.
I did some digging and saw that the UI is using a POST to create a new record but this is done by giving a negative number like “-606”.
Tried to replicate this but without success.
hillel
November 24, 2021, 5:50pm
8
I believe you want to send a POST request to /tasks
mazzaa
November 24, 2021, 6:10pm
9
And what about the id?
if we use a POST on the /tasks endpoint then we have to provide a json with an valid id
is there another way to get a new id ?
hillel
November 24, 2021, 6:47pm
10
The id is automatically set by the app, it will be included in the response