Number allocation when issuing POST call

lock
push_pin
done
Beantwoord
3

Hello Everyone,

I have a problem when issuing a API POST call to either the Person or Contact entity. Both entities make use of a so-called number allocation, but I seemingly cannot tap into  this functionality when issuing the call. 

I have tried:

  • Not specifying the field in the body that I post, hoping that the (next) number would be allocated automatically. It did not, unfortunately. It left the field blank, even though the settings specifies that the field cannot be blank.
  • Specifying the field and its value in the body. I did this by first making a POST call to the GetRefCountEntity agent and getting the current value of the specific RefCountId then adding 1 to that number ("Number2") - the body would look like this (abbreviated):

{
  "Name": "MitTestFirma",
  "OrgNr": "12341234",
  "Number2": 35067,
  "Emails": [
    { ...
etc etc
}

This method is not working either: When I query the GetRefCountEntity agent again after posting, the value has not changed for the specific entity.

Does anyone have a suggestion on how to get this to work - if possible.

 

Thank you in advance and merry Christmas.

Henrik

7 u, 9 m geleden | 10:19 a.m.

Alles Antwoorden (3)

Hi Henrik,

You need to use the 'Get default' functionality to first get a entity with the number allocated/default values filled in, see GET Contact/default 

You can then use that response to fill in your values, and then POST that.

7 u, 5 m geleden | 10:23 a.m.
Hi David,
Thank you for a very speedy reply - much appreciated!

Just to make sure I understand the functionality correctly and how I apply it to my specific needs, can you verify the following:

1: In my data flow, I first issue this GET call that you describe, to get the system to issue a new number (like taking a ticket from a ticket dispenser at a bakery).
2: I can then use the specific value like by inserting that value in the "Number2" field for instance in my ensuing POST call?

Best Regards,
Henrik
6 u, 56 m geleden | 10:32 a.m.
Hi Henrik,
Yes, but i would recommend that you use the full response of the /default call, and modify that based on your needs, since the /default call will do more then just the Number2 field (will also set default values from custom fields for example)
6 u, 54 m geleden | 10:34 a.m.

Reply toevoegen