podio-php icon indicating copy to clipboard operation
podio-php copied to clipboard

podio get_basic_by_field not work

Open mehermakloufi opened this issue 4 years ago • 4 comments

I want to fetch podio data using field_id and item_id . I use this function and it does not work for me :

$fild_value = PodioItem::get_basic_by_field( $item_id, $field_id );

And output is : "PodioBadRequestError (1) PodioBadRequestError" .

mehermakloufi avatar Mar 19 '20 13:03 mehermakloufi

A bad request usually is something wrong with the data you are sending; Please check item_id and field id and try again

rafaelmb avatar Mar 19 '20 15:03 rafaelmb

A bad request usually is something wrong with the data you are sending; Please check item_id and field id and try again

I try since this morning and the same problem, though item_id and field_id as true

mehermakloufi avatar Mar 19 '20 16:03 mehermakloufi

and my real probleme is :

I fetch data from podio CRM using PHP language and I fetch data for each element via its id as it is found in this function:

public function getContacts($item_id) {

$this->contactAuth();

$item = \PodioItem::get_by_app_item_id($podio_contact_app_id,$item_id);
  return $item;

}

For example we have the 'Status' we show it like this:

$status = $item->fields[6]->values;

Not all elements get it right though it is the same function.

Sometimes :

$status = $item->fields[6]->values;

and sometimes :

$status = $item->fields[8]->values;

I tried to access data via a function : get_basic_by_field() but it did not work

What is the simplest solution to these problems? Can we know what caused the problem?

mehermakloufi avatar Mar 19 '20 16:03 mehermakloufi

Yeah that looks dangerous, get a field value by it's array position.

Can you try changing it to the external_id ? It's the second best (the best is field_item_id but that is annoying to use specially in multiple environments)

rafaelmb avatar Mar 19 '20 20:03 rafaelmb