Podio API PHP: Set Default View
I've create a view using the API and am now looking to set this view as the default view. I've tried doing what is described in the documentation here..
https://developers.podio.com/doc/views/make-default-155388326
Podio::post("/view/{$viewId}/default");
This does not work. I'm getting the following response from the call...
PodioResponse Object
(
[body] =>
[status] => 204
[headers] => Array
(
[server] => nginx
[date] => Mon, 07 Mar 2016 13:46:25 GMT
[content-type] => text/html;charset=utf-8
[connection] => keep-alive
[x-rate-limit-remaining] => 4940
[x-rate-limit-limit] => 5000
[x-podio-auth-ref] => user_3224585
[x-podio-request-id] => pLpPCkrx
[x-served-by] => api-i-a205c4e1
)
)
I'm not quite sure what status of 204 means, but the body being null is telling me it didn't work.
What might I be doing wrong here?
-
Well, check the UI that it didn't work (remember to reload), see https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for explanation of code 204 :)
Also, are all the requirements met? ("Makes the view with the given id the default view for the app. The view must be of type "saved" and must be active. In addition the user most have right to update the app")
So, the view must be saved and active, and user must have right to update the app - app authentication won't work.
-
Hi Henrik,
Thanks for the link, that will be very helpful in the future.
I did reload the page after "marking it as default" and the View in question stays at the bottom and does not become the default.
Now lets talk about the requirements...
What is type "Saved"? If I create the view using the API I'm assuming it is saved if it shows up along the left side. Or is there some sort of flag I have to tick when creating the view using the API?
User must have the right to update the app. The creation of the view and then marking it as default are both done by the same API process and thus the same user. So I definitely meet this criteria (i would hope).
I did get around this issue by having the API process delete all the existing Views and then recreating them in the order I want...Default view being created first. This works and is probably a better solution.
Please sign in to leave a comment.
Comments
2 comments