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) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Force Event Id on API create?
Pages: [1]

Author Topic: Force Event Id on API create?  (Read 565 times)

DerekL

  • I post frequently
  • ***
  • Posts: 132
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.54
  • PHP version: 5.2.17
Force Event Id on API create?
November 29, 2011, 11:46:01 am
Hi Guys and Gals,

I created a module that eats CSVs and creates events using the fantabulous API but I'm having an issue:

I have to import and match participants to these events, and since I can't match to custom data "Old Event ID" in the particpation import screen, I was wondering if you guys have any idea how to force Event Id's on the Event Create API Call.

When I try passing something like this, my ID gets ignored.

$params = array(
         'version'=>3,
              'id'=>$data[0],
        'title'=> $data[1],
            'description' => $data[2],
       'event_type_id'=>4,
       'loc_block_id'=>1,
            'start_date'=>$data[3],
            'end_date'=>$data[4],
            'custom_5'=>$data[0],


I understand that mysql has the ID set to autoincrement, but when I tried disabling it for the duration of the import, I wasn't able to renable it in a way that left anything working. :/



Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Force Event Id on API create?
November 30, 2011, 07:12:45 am
Why can't you use the id that is returned by the API call?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Force Event Id on API create?
November 30, 2011, 07:25:26 am
While you are having fun with the api (glad you like it ;), I'd write as well a custom import for the participants

As the first step, fetch all the events (including the custom_ old id) create a table that map oldid (the key) and new id and use it to populate the event_id on api.participant.create

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

DerekL

  • I post frequently
  • ***
  • Posts: 132
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.54
  • PHP version: 5.2.17
Re: Force Event Id on API create?
November 30, 2011, 12:37:09 pm
Yep,

That's why I come here, thanks!

I'll try this out and report back.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Force Event Id on API create?

This forum was archived on 2017-11-26.