BranchMetrics / branch-deep-linking-public-api

The Branch Metrics public API for mobile deep linking / deeplinking applications. Branch helps mobile apps grow with deep links / deeplinks that power referral systems, sharing links and invites with full attribution and analytics.
https://dev.branch.io/references/http_api/
145 stars 18 forks source link

Updating an existing link overrides existing data #28

Closed mieszko4 closed 1 year ago

mieszko4 commented 6 years ago

I do two requests.

Creating link

{ url: 'https://api.branch.io/v1/url',
  json: true,
  headers: { 'Content-Type': 'application/json' },
  body: 
   { branch_key: 'key_test_***',
     channel: 'IvySpace',
     data: { roboadvisor_form_id: 5 } } }

Note that I added custom data roboadvisor_form_id

Updating the created link

{ url: 'https://api.branch.io/v1/url',
  qs: { url: 'https://ivyspace.test-app.link/WIUn37uT3L' },
  json: true,
  headers: { 'Content-Type': 'application/json' },
  body: 
   { branch_key: 'key_test_***',
     branch_secret: 'secret_test_***',
     data: 
      { '$android_wechat_url': 'https://www.ivyspace.com/wechat?branch=https%3A%2F%2Fivyspace.test-app.link%2FWIUn37uT3L',
        '$ios_wechat_url': 'https://www.ivyspace.com/wechat?branch=https%3A%2F%2Fivyspace.test-app.link%2FWIUn37uT3L' } } }

After updating the link custom data roboadvisor_form_id is gone. In https://ivyspace.test-app.link/WIUn37uT3L?debug=1 I see the following:

{
"$android_wechat_url": "https://www.ivyspace.com/wechat?branch=https%3A%2F%2Fivyspace.test-app.link%2FWIUn37uT3L",
"+url": "https://ivyspace.test-app.link/WIUn37uT3L",
"~creation_source": 0,
"$one_time_use": false,
"~id": "513040571548724556",
"~channel": "IvySpace",
"$ios_wechat_url": "https://www.ivyspace.com/wechat?branch=https%3A%2F%2Fivyspace.test-app.link%2FWIUn37uT3L"
}

This is inconsistent with what it says in the docs:

The new link returns existing data of the link plus the newly added data of the link.

poyor7 commented 6 years ago

i also have this kind of problem when creating link where i include 'data': { '$canonical_identifier': 'content/123', 'custom_boolean': true, 'custom_integer': 1243, 'custom_string': 'everything', 'custom_array': [1, 2, 3, 4, 5, 6], 'custom_object': { 'random': 'dictionary' } } but when i read the link there is no data