简体   繁体   中英

Hubspot form - request is not valid Angular 9

I was trying to use my custom form and send information to Hubspot forms api. But I was getting error: The request is not valid . I'am using httpclient from angular libs.

 contact() {
    return this.httpClient
        .post('https://api.hsforms.com/submissions/v3/integration/submit/portalid/guiid', {
            body: {
                legalConsentOptions: '',
                fields: [
                    { name: 'email', value: 'example@email.com' },
                    { name: 'firstname', value: 'asd' },
                    { name: 'lastname', value: 'asd' },
                    { name: 'message', value: 'asd' },
                ],
            },
        })
        .subscribe(
            res => {
                console.log(res);
            },
            error => {
                console.log('err', error);
            },
        );
}

Email, portalid, guiid I have changed for now, because it is secret.

我已经从请求中删除了 body 标签,现在它正在工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM