Skip to main content

We are happy to announce that you can now access knowledge base API endpoints through the Core API.

 

These endpoints allow you to read and update your internal and external Front knowledge bases. With the API, you now have the flexibility to process your knowledge base content for various purposes, including advanced display on different websites and additional means of importing content.

 

Read the docs on our Developer Portal to start using the knowledge base API endpoints.

Looking forward to seeing what can be done with this. 


@JohnW Let us know if you have any feedback!


Hi Javier, 

 

I’m trying to use the Knowledge bases APIs to update our community federated search with new article published on the knowledge base. Though I can’t find an easy way to get public ID, url, etc for all articles.

I’ve tried:

  • The public API: but the endpoint /en/articles.json does not exist, tbf only home.json return something for me, I don’t know where I can get the IDs of the categories or articles 
  • the CRUD API: it looks like it uses ID for articles that are internal only, not the public facing id that we have in the public URL → is there a way to get those somewhere ?

Best,


Hey ​@terpo 

 

It’s a bit buried, but if you list the articles for a knowledge base, you should see the links in the _results > _links > related > content field of the response. You can access this field in for any KB CRUD API endpoint that returns an article or a list of articles.

 

Let me know if that doesn’t work for you!


Hey ​@terpo 

 

It’s a bit buried, but if you list the articles for a knowledge base, you should see the links in the _results > _links > related > content field of the response. You can access this field in for any KB CRUD API endpoint that returns an article or a list of articles.

 

Let me know if that doesn’t work for you!

Thanks , 

Well, I’m not sure, when I do that I get an ID : 

Though when I try to use it on the URL : 

https://user-guide.opendatasoft.com/en/articles/kba_1bsn6 I get a 404, the URL that work is https://user-guide.opendatasoft.com/en/articles/2229954 for this article.

I don’t know where can I find the 2229954 via the API ?


Hi ​@terpo , 

It’s definitely not as easy as it should be to fetch the public article ID /path from the authenticated API - our team are taking a look at that.

In the meantime, it is possible to use base36 encoding/decoding to switch between the private and public versions of the ID:

The part of the private (kba_...) ID after the underscore can be run through the JS parseInt(id, 36) function to convert to the public ID. 

Similarly, we can run the public ID through toString(36) to encode it to the suffix that sits after the “kba_” API ID prefix.

➜  ~ node
Welcome to Node.js v20.11.0.
>
> const publicId = "kba_1bsn6"
> parseInt(publicId.split('_')c1], 36)
2229954
>
> const privateId = 2229954
> `kba_${privateId.toString(36)}`
'kba_1bsn6'
>

We’ll be sure to share an update when we make this clearer + more accessible in the API


Hi ​@terpo , 

It’s definitely not as easy as it should be to fetch the public article ID /path from the authenticated API - our team are taking a look at that.

In the meantime, it is possible to use base36 encoding/decoding to switch between the private and public versions of the ID:

The part of the private (kba_...) ID after the underscore can be run through the JS parseInt(id, 36) function to convert to the public ID. 

Similarly, we can run the public ID through toString(36) to encode it to the suffix that sits after the “kba_” API ID prefix.

➜  ~ node
Welcome to Node.js v20.11.0.
>
> const publicId = "kba_1bsn6"
> parseInt(publicId.split('_')c1], 36)
2229954
>
> const privateId = 2229954
> `kba_${privateId.toString(36)}`
'kba_1bsn6'
>

We’ll be sure to share an update when we make this clearer + more accessible in the API

Thanks Jason, that does work for me.


Hey all - just wanted to share some thoughts on the new knowledge base system that's  out. I'm actually pretty excited about this upgrade. 

The authentication setup is particularly well thought out - while you'll need an API token for the main endpoints (sorry OAuth fans, not yet!), they've added this really smart public API option for published knowledge bases. Super useful for quick integrations.

What I'm really loving is the multi-language support. They've covered pretty much every major language you can think of, from Japanese to Portuguese (both Brazil and Portugal variants) to Ukrainian. This is going to make localization so much easier compared to the old system where we had to handle translations manually.

The one-category-per-article structure might seem limiting at first, but I think it actually helps keep things organized. No more messy cross-categorization debates!

Has anyone else started implementing this? I'd be curious to hear how it's working in production, especially for those of you managing documentation in multiple languages.


Reply