CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • API for delete Address only.
Pages: [1]

Author Topic: API for delete Address only.  (Read 1882 times)

Siv

  • I post occasionally
  • **
  • Posts: 94
  • Karma: -17
  • CiviCRM version: 4.6.2
  • CMS version: Drupal 7.44
  • MySQL version: 5.5.24
  • PHP version: 5.3.13
API for delete Address only.
December 06, 2011, 11:11:05 pm
If i use civicrm_location_delete( $params) , $params = array('contact_id'         => $_GET['cid'], 'location_type'      => $params['hdn_location_id'] ) , it is deleting email,phone,address in that location but i want delete only Address on specific location.

Thanks in advance.......

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: API for delete Address only.
December 07, 2011, 01:01:50 am
Use the address API.

You can visit on your site /civicrm/api/explorer to see the ones available

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

jeevajoy

  • I’m new here
  • *
  • Posts: 18
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: joomal 1.6
  • MySQL version: 5
  • PHP version: 5
Re: API for delete Address only.
December 07, 2011, 03:27:42 am
try this with valid parameters

$results=civicrm_api("Address","delete", array ('q' =>'civicrm/ajax/rest', 'version' =>'3', 'id' =>'18', 'contact_id' =>'25'));



Cheers,
Jeeva.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: API for delete Address only.
December 07, 2011, 03:35:55 am
Hi Jeeva,

you don't need the 'q' parameter (and almost sure you don't need the contact_id either, id is enough)

@sivaunq,

Never use directly $_GET or $_POST params, always clean them, otherwise your code is insecure and you will have sql injections

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

jeevajoy

  • I’m new here
  • *
  • Posts: 18
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: joomal 1.6
  • MySQL version: 5
  • PHP version: 5
Re: API for delete Address only.
December 07, 2011, 04:39:35 am
Hi Xavier,

Thank you. Is there anyway in API to get the customfields used for Memberships....

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: API for delete Address only.
December 07, 2011, 01:33:16 pm
Haven't tested, but the custom field ones should let you get that (they are rather poorly named UFxxx, except UFJoin that is for mapping contacts & users).

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Siv

  • I post occasionally
  • **
  • Posts: 94
  • Karma: -17
  • CiviCRM version: 4.6.2
  • CMS version: Drupal 7.44
  • MySQL version: 5.5.24
  • PHP version: 5.3.13
Re: API for delete Address only.
December 07, 2011, 11:15:34 pm
The below function is not working. Call to undefined function civicrm_api()
$results=civicrm_api("Address","delete", array ('q' =>'civicrm/ajax/rest', 'version' =>'3', 'id' =>'18', 'contact_id' =>'25'));

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: API for delete Address only.
December 07, 2011, 11:51:48 pm
Did you include the api?
Code: [Select]
require_once('api/api.php');
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Siv

  • I post occasionally
  • **
  • Posts: 94
  • Karma: -17
  • CiviCRM version: 4.6.2
  • CMS version: Drupal 7.44
  • MySQL version: 5.5.24
  • PHP version: 5.3.13
Re: API for delete Address only.
December 08, 2011, 12:50:13 am
i couldn't find api/api.php in my civicrm folder .
require_once('api/api.php');

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: API for delete Address only.
December 08, 2011, 05:04:56 am
What version of CiviCRM are you using? api/api.php is only available from version 3.4.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: API for delete Address only.
December 08, 2011, 06:20:01 am
sivaunq is already on 3.5, maybe we will rename it and he comes from the future to warn us? ;)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: API for delete Address only.
December 08, 2011, 07:06:38 am
Spoooooooooky  :o
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • API for delete Address only.

This forum was archived on 2017-11-26.