Back

[SOLVED] 400() error....

  • 1
  • Web
bharath
31 Mar, 2023, 19:14

const handleChange = (event) => { event.preventDefault(); props.setSelectedValue(event.target.value); const client = new Client() client.setEndpoint('https://api.printfc.in/v1') // Your API Endpoint .setProject('64242c801cdd58d2213'); const databases = new Databases(client); const promise = databases.createDocument( '6426fd4b827fedc4a235', '6426fd9b65c0b7f2c561', ID.unique(), {
opt1, opt2, opt3, opt4,

TypeScript
    }
);

promise.then(function (response) {
    console.log(response);
}, function (error) {
    console.log(error);
});

};

TL;DR
There is a support thread discussing a 400() error. The user is asking for help with their code, specifically with replacing values in "userId" and "fileId" fields. Another user suggests adding the code {opt1, opt2, opt3, opt4} to the "selected-value" field, but it is not a valid JSON format. The user also asks about the type of "selected-value". Solution: Replace "userId" and "fileId" values with the appropriate values. Fix the syntax in the "selected-value" field by providing valid JSON. Additionally, clarify the type of "selected-value".
rafagazani
31 Mar, 2023, 19:17

what is the type of the selected-value?

bharath
31 Mar, 2023, 19:18

string

rafagazani
31 Mar, 2023, 19:18

there is the error

rafagazani
31 Mar, 2023, 19:19

{ "selected-value": "your fields here"

TypeScript
    }
bharath
31 Mar, 2023, 19:19

where should i add it

rafagazani
31 Mar, 2023, 19:19

this is not a valid json:
{ opt1, opt2, opt3, opt4,

TypeScript
    }
bharath
31 Mar, 2023, 19:20

??

rafagazani
31 Mar, 2023, 19:20

`const handleChange = (event) => { event.preventDefault(); props.setSelectedValue(event.target.value); const client = new Client() client.setEndpoint('https://api.printfc.in/v1%27) // Your API Endpoint .setProject('64242c801cdd58d2213'); const databases = new Databases(client); const promise = databases.createDocument( '6426fd4b827fedc4a235', '6426fd9b65c0b7f2c561', ID.unique(), { "selected-value": "your fields here" } );

TypeScript
promise.then(function (response) {
    console.log(response);
}, function (error) {
    console.log(error);
});

};`

bharath
31 Mar, 2023, 19:21

what should i replace in "your fields here"

rafagazani
31 Mar, 2023, 19:22

`const handleChange = (event) => { event.preventDefault(); props.setSelectedValue(event.target.value); const client = new Client() client.setEndpoint('https://api.printfc.in/v1%27) // Your API Endpoint .setProject('64242c801cdd58d2213'); const databases = new Databases(client); const promise = databases.createDocument( '6426fd4b827fedc4a235', '6426fd9b65c0b7f2c561', ID.unique(), { "selected-value": "{userId:12345,numberPages:10,numberCopies:2,Colorful:true,BothSides:false,fileId:abcdefg}" } );

TypeScript
promise.then(function (response) {
    console.log(response);
}, function (error) {
    console.log(error);
});

};`

bharath
31 Mar, 2023, 19:24

what value should i replace in userId and fileId

bharath
31 Mar, 2023, 19:25

and should i set numpagesand etc to default

rafagazani
31 Mar, 2023, 19:25

the fields you want to store

bharath
31 Mar, 2023, 19:26

where does that fields present

rafagazani
31 Mar, 2023, 19:27

no website

bharath
31 Mar, 2023, 19:31

???

rafagazani
31 Mar, 2023, 19:34

What is your frontend programmed for?

bharath
31 Mar, 2023, 19:35

to upload files and to input the values

joeyouss
12 Jun, 2023, 04:27

Hi @Bharath if no extra help is needed here can we close this?

Bharath
12 Jun, 2023, 04:28

I think you have mentioned wrong guy 🙂

joeyouss
12 Jun, 2023, 09:10

Sorry!

joeyouss
12 Jun, 2023, 09:11

My apologies

bharath
12 Jun, 2023, 13:47

[solved] 400() error....

Guille
12 Jun, 2023, 13:59

[SOLVED] 400() error....

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more