diff --git a/fulcrm_apiv2.module b/fulcrm_apiv2.module index 9f43045..a963ba8 100644 --- a/fulcrm_apiv2.module +++ b/fulcrm_apiv2.module @@ -44,6 +44,16 @@ function fulcrm_apiv2_prevent_loop( $headers ) { return true; } +function fulcrm_apiv2_url_to_type( $url ) { + preg_match( '/https:\/\/[^\/]+\/api\/v2\/([a-z_0-9]+)\/([0-9]+)?\//', $url, $matches ); + return $matches[ 1 ]; +} + +function fulcrm_apiv2_url_to_pk( $url ) { + preg_match( '/https:\/\/[^\/]+\/api\/v2\/([a-z_0-9]+)\/([0-9]+)?\//', $url, $matches ); + return intval( $matches[ 2 ] ); +} + function fulcrm_apiv2_http( $method, $object = null, $data = null, $query = null ) { $url = null;