Post

2 followers Follow
0
Avatar

Trouble with API filtering on a field called STATUS

I am getting errors when using PodioItem::filter() when the field I am trying to filter on is called "STATUS" as it's external ID. Is this because each field has a status itself so the API is getting confused?

I had thought of using the numerical field ID instead, however my script references different installs of the same app, so the numerical field ID changes with each new install.

$collection = PodioItem::filter(APP_ID, array(
'filters' => array(
//'107670015' => array(4)
'STATUS' => array(4)
)));

Fatal error: Uncaught PodioBadRequestError: "Invalid value "STATUS" (string): Invalid filtering key"

 

Am I boned?

Joshua Hay

Official comment

Avatar

Hi Joshua,

If "107670015" is indeed the ID of the field you are filtering by, I can tell you that it's external id is "approved", not "STATUS". The app this field belong to does not have any fields with an external id of "STATUS" or "status".

So you simply get that error message from the API because the external id "STATUS" is not an existing field in the app.

Casper Fabricius

Please sign in to leave a comment.

3 comments

0
Avatar

Hi Casper,

You are correct - in actual fact it's the fields with external-id of "approved" that are causing me grief. I believe due to a conflict with the "approved : true/false" boolean field on the app item.

Fatal error: Uncaught PodioBadRequestError: "Invalid value for rating of type approved. Value was 4, but must be between 0 and 1"

Joshua Hay 0 votes
0
Avatar

Hi Joshua,

Podio does not have a "boolean" type field. The "approved" field is a category type field with two options: True (id: 0) and false (id: 1). When you post your values to the API, you must use a valid category option id. In this case, you are posting a value of "4", but only "0" and "1" are valid option ids for the "approved" field.

Casper Fabricius 0 votes