Changing the primary constituent code via SKY API?

Hi,


With year-end coming up at my school, I was planning on using SKY API to rollover constituencies (e.g. graduated seniors to "Alumni"), but I don't see how I can do that with the current construct.


From my experimentation, it appears that:


1) The JSON for Constituent Code is in the order it is in NXT, therefore the first item listed is the primary constituent code.

2) POST Constituent Code puts a new code at the end.

3) PATCH Constituent Code appears to only be able to change the start/end date of an individual code.


So how can we change the primary constituency (ie put it at the top of the JSON listing of codes)? Do we have to delete and then recreate all the codes?


Cheers,

Scott

Comments

  • Hi Scott, did you figure out the answer here? We are also wanting to make sure we assign primary constituency codes correctly via API and could use your insights.

  • I think that the way you do this is to post a new constituent code and add the sequence parameter as 1. So, for example, like this:

    {

    "constituent_id": "11278",
    "description": "Volunteer",
    "end": { "d": 13, "m": 11, "y": 2023 },
    "start": { "d": 12, "m": 01, "y": 2022 },
    "sequence": 1

    }

    This will put this constituent code at the top of the list and it will become the primary.

  • Hi David,

    Thanks – Seth, did you see this?

    I posted that almost 2 years ago. I didn't even remember I had done it and now there's 2 replies in the last month – cool.

    I'll try that solution as soon as I am able. I was in another job when I wrote the post. I'm back to doing RE work and was looking for a non-SKY API way to do it as I'm not an Environment Admin at the school (yet). Good to know there's a solution, now all I have to get is permission to use it.

    Cheers,

    Scott

  • Since I wrote the original post, “sequence” was added so the whole JSON order doesn't necessarily apply. I'm currently trying to switch two constituencies because the person that did them just added the newest one to the bottom not knowing that the first in the list is considered primary.

    I had some problems initially when I tried to change the secondary's “sequence” to 1 (I thought that was the most “parallel” method to what you do as an NXT user when you click the Top button. But both got stuck with a sequence of 1 – no success.

    Then I tried the opposite, PATCH the one that is incorrectly “sequence”: 1 by editing it to “sequence”: 2. After that PATCH the desired constituency to “sequence”: 1. It seemed to work. I haven't programmatically tried it on a big number of records – I'll let you know if it was successful.

    Cheers,

    Scott

  • It was successful.