Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not upload file using V2 API #8

Open
tonytangau opened this issue Mar 30, 2017 · 0 comments
Open

Can not upload file using V2 API #8

tonytangau opened this issue Mar 30, 2017 · 0 comments

Comments

@tonytangau
Copy link

tonytangau commented Mar 30, 2017

Keep getting 500

500 - An error has occurred and administrators have been notified. For more information, please contact * with reference code "soidfdix"

when post file to upload:

    const config = {
        headers: {
          "Authorization": `Bearer ${TOKEN}`,
          "Content-Type": "multipart/form-data" //application/json
        }
    }

    const payload = {
      "file": fs.readFileSync(filePath),
      "fileUri": FILE_URI,
      "fileType": "json"
    }

    axios.post(SMARTLING_URL, payload, config)
    .then(res => {
      return res;
    })
    .catch(e => {
      return e
    })

Also tried FormData and pipe fs.readFile, but none of them are working. Could you please provide a clearer example of how to POST to your API?

BTW, I'm also considering creating a node-smartling package to help the others so they can easily use V2 API without the hard work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant