diff --git a/lib/Sipwise/API.pm b/lib/Sipwise/API.pm index 40de6f30..a26ce09b 100644 --- a/lib/Sipwise/API.pm +++ b/lib/Sipwise/API.pm @@ -213,7 +213,13 @@ sub _exists { my $collection = $self->_get_content($data, $urldata); if (defined $collection && $collection->{total_count} == 1) { - my $links = $collection->{_embedded}->{$collection_id}->{_links}; + my $tmp = $collection->{_embedded}->{$collection_id}; + my $links; + if (ref $tmp eq 'ARRAY') { + $links = $tmp[0]->{links}; + } else { + $links = $tmp->{links}; + } my $href = $links->{self}->{href}; return _get_id($urldata, $href); }