Solved

External Link Id Lookup via External Url

  • 6 January 2023
  • 2 replies
  • 93 views

Badge +2

On the following page:

 

https://dev.frontapp.com/docs/search-1 

 

You note that when searching for conversations via Link, you need the ID of the link and to get an existing link id you must use the Links endpoint.

 

The link ID is not the same as the name of the link. To obtain a link ID, use the List Links endpoint.

 

However, I have tried crafting a query to search for a link by existing external url unsuccessfully.  Can you provide an example?

icon

Best answer by Support Engineering 6 January 2023, 19:45

View original

2 replies

Userlevel 1
Badge +5

Right now, we don't have an API endpoint available for performing a link lookup, but the Create Link API endpoint does perform a "create or fetch".

 

As an example, I might have this link:

{
"_links": {
"self": "https://cloud-content-consulting.api.frontapp.com/links/top_4et1p"
},
"id": "top_4et1p",
"name": "Order 0002736",
"type": "web",
"external_url": "https://example.com/orders/0002736"
}

 

I can perform the following call to the Create Link endpoint, and I will get that link back in my result because the link already exists:

➜  ~ curl -XPOST 'https://api2.frontapp.com/links' -d '{"external_url": "https://example.com/orders/0002736"}'

{
"_links": {
"self": "https://cloud-content-consulting.api.frontapp.com/links/top_4et1p"
},
"id": "top_4et1p",
"name": "Order 0002736",
"type": "web",
"external_url": "https://example.com/orders/0002736"
}

Or, if you're using Postman, it could look like this:

If you do not specify a name field in this create call, the API will return the existing link with the existing name. If you do provide a "name" field, the existing link will be returned, and the name will be updated on the link.

 

After making this first API call to create or fetch the link, you can issue a call to the list link conversations API endpoint to return all conversations currently tagged with that Link. 

 

I recognize that while this approach should work, it could perhaps be more effective to offer a specific endpoint for fetching Links by their external_url value. This has been previously requested, and I'll go ahead and your vote as a plus one to that feature request to see if this is something we can introduce in the future.

 

Let me know if you have any other questions or concerns, and enjoy the rest of your day!

 

--Leslie

Badge +2

Thanks Leslie, very helpful.

Reply