PhoneNumber and ActionHistoryRecord Entities

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eduardofendrich
    Member
    • Jul 2021
    • 49

    PhoneNumber and ActionHistoryRecord Entities

    Hi,

    I'm working on a migration project, and I have 2 questions:

    a) How do I import multiple contact phones? /api/v1/Contact/{id}/PhoneNumber is not available... If I send a GET to /api/v1/Contact/{id}, I get only one phone number. Who can I get all of them?

    b) Customer would like to import history contacts from the old application. So, I think the best approach would import these informations to ActionHistoryRecord, but I get permission problems with the API.

    Can anyone more experienced help me?


    Thanks in advance

    Eduardo
    Last edited by eduardofendrich; 10-07-2021, 12:47 PM.
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Hello,


    1) phoneNumberData contains all phoneNumber, type and so
    2) i don't know out-of-box, but you can make your own script (entryPoint or API) and fetch all.
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • eduardofendrich
      Member
      • Jul 2021
      • 49

      #3
      Hi,

      Thanks

      1-I'll check, thanks.
      2-Use Stream API. POST and GET works.

      Comment

      • eduardofendrich
        Member
        • Jul 2021
        • 49

        #4
        Item 2, OK.

        Item 1, my problem persists. I've read your suggestion, but there is nothing about how use PhoneNumberData with REST calls.

        Thanks

        Comment

        • item
          Active Community Member
          • Mar 2017
          • 1476

          #5
          Hello,
          if you make a get /api/v1/Contact/{id}. ... phoneNumberData is here emailAddressData too




          "emailAddressData":[{"emailAddress":"micha@puerto_demo.lk","lower": "mi cha@puerto_demo.lk","primary":true,"optOut":false, "invalid":false}],"phoneNumberData":[{"phoneNumber":"123-979-070","type":"Other","primary":true,"optOut":false , "invalid":false}],
          If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

          Comment

          • eduardofendrich
            Member
            • Jul 2021
            • 49

            #6
            Thanks, for reading it's ok, I get them. But how should I convert into a REST POST call?

            $response = $client->request('POST', 'Contact',
            ['firstName' => 'firstName',
            'lastName' => 'surname',
            'phoneNumberData' => '***'
            ]
            );

            *** should be '[{"phoneNumber" => "123","type" => "Other","primary" => true,"optOut" => false, "invalid" => false},
            {"phoneNumber" => "124","type" => "Other","primary" => false,"optOut" => false, "invalid" => false}]'
            ?

            Comment

            • item
              Active Community Member
              • Mar 2017
              • 1476

              #7
              i know in v6 Yuri have make some change (api/entryPoint method Get - Post. .but forget)
              if i understand your question

              'phoneNumberData' => [
              [
              "phoneNumber" => "blabla",
              "type" => "Office"
              ],
              [
              "phoneNumber" => "blabla2",
              "type" => "Mobile"
              ],

              ]
              If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

              Comment

              • eduardofendrich
                Member
                • Jul 2021
                • 49

                #8
                Yes, you got the point. I'm able to do hard coded, but do you know how to create this structure dinamically? (some contacts have 1 phone, others have 2, someothers 3)

                Comment

                • item
                  Active Community Member
                  • Mar 2017
                  • 1476

                  #9
                  Hello,

                  it's a array of ... object or json

                  $matrix = [
                  (object) [
                  'type' => 'linkedin',
                  'url' => 'blabla.com',
                  'isActive' => false,
                  ],
                  (object) [
                  'type' => 'facebook',
                  'url' => 'fafa.com',
                  'isActive' => true,
                  ]
                  ];

                  for i= 1 < countContact

                  phoneNumberData[] = json_encode( ['phoneNumber' => 'blabla' ] )

                  I thinks something so
                  If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

                  Comment

                  Working...