Skip to content

How to use API to import OPML? #1031

Answered by Athou
Jorenar asked this question in Q&A
Jan 6, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

You need to post a FormData object and set the file param to the opml content. file is the name expected by CommaFeed for the opml in the POST body.

const formData = new FormData();
formData.append("file", opmlFile);

opmlFile is usually the value from the file picker but it seems you have the opml as xml or string. I think you'd need to construct a File yourself then: https://stackoverflow.com/a/26181292

After that you can set formData as the value for body in your fetch : body: formData.

See

importOpml: (req: File) => {
const formData = new FormData()
formData.append("file", req)
return axi…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Jorenar
Comment options

Answer selected by Jorenar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants