Wave API Help
I've gone through the API setup video and confirmed I can read data in Insomnia, are there any guides for next steps? I'm very new to interacting with APIs, and my main goal is to have custom user fields and be able to update those through the API. Thanks in advance.
Hello,
I think that the best place to refer to is the documentation. You can find the API documentation here:
What I could suggest is using the Posts
API endpoint and adapt it for your other models:
Request Data with an Access Token
For example, if you wanted to add a new post, you would need to make a POST request to the /api/posts
endpoint.
If you wanted to update/edit an existing post, then you would need to make a PUT request to the /api/posts/{id}
endpoint and update the fields that you want.
Hope that this helps and let me know if you have any questions.
Best,
Bobby
"What I could suggest is using the Posts API endpoint and adapt it for your other models:"
Yep, that's what I'm looking for a little more direction on. I did go through the API docs link as well, and I'm at the same spot now where I don't know quite how to adapt that for what I need now.
Is there a list somewhere of the other available areas besides posts for example? The endpoints.json has this for example: "isPrivate": false, "metaSortKey": -1529805624299.375, "method": "POST", "modified": 1530204902318, "name": "Add Post", "parameters": [], "parentId": "fld_6aa779130b3049b5bf87e51c00098251", "settingDisableRenderRequestBody": false, "settingEncodeUrl": true, "settingRebuildPath": true, "settingSendCookies": true, "settingStoreCookies": true, "url": "{{ base_url }}/api/posts", "_type": "request"
what else could be passed besides "/api/posts"?
Hi there,
You can change the /api/posts
part with any of your models. For example, let's say you had a Model called Video
, you could access the video endpoint via /api/videos
.
Or if you wanted to modify a specific field in an existing entry, you could do a PUT request, for example let's say you wanted to edit the title of the video with ID 2, then your request would look like this:
curl -X PUT \
-H "Authorization: Basic ${token}" \
-H "Content-Type: application/json"\
--data '{"name":"My new video title"}'\
wave.test/api/videos/2
Let me know if you have any other questions. Best, Bobby
This has definitely helped me, I'm able to modify existing fields now. Thank you! I'll continue working on the remaining API funtionality. One last question, how can I modify the user model to have more custom fields?
















Hello,
One way of doing this is to add more columns to the Users table. You could do that directly via the Wave admin -> Settings -> Database -> Find the users table -> add the column there.
Or the official way of doing this would be via a Laravel migration as described in this tutorial here:
How to Add a New Column to an Existing Table in a Laravel Migration?
Hope that this helps!
Best,
Bobby
Hey Cezar,
Yes, via the API you can access all of your models as normal, eg api/{datatype}
.
The API docs can be found right here: