[#266] Intake forms

Migrated from Redmine #266 | Author: David Saenz
Status: New | Priority: Normal | Created: 2018-10-22


Hi,
I have created a couple of intake fields.
But when I try to make a reservation with the book method, even though I send the data of the new field, it tells me that the field is obligatory.

For example, I added a field ‘document’. When I make a reservation in addition to the name, email and phone, I add a node to the json of the client parameter.

{name: ‘Lore’: email: ‘lorem@ipsum.com’, phone: ‘654654654’, document: ‘654654654’}

This field is of the simple line type.

Do I have to send this information in a different way?

Redmine Admin wrote:

you need to call Company public service methods - Company public service methods - SimplyBook.me
and then use additional field hash it returns as identifier, not name

David Saenz wrote:

Redmine Admin wrote:

you need to call Company public service methods - Company public service methods - SimplyBook.me
and then use additional field hash it returns as identifier, not name

What do you mean, ‘by id’?

When I make the call to getAdditionalFields, the hash it gives me for the field ‘document’ is for example ‘59953ee728fc870866f831637b795eef’.

Do you mean that I have to send the client json in the following way?

{name: ‘lorem’, email’lorem@ipsum.com ‘, phone:’ 654654654 ‘,’ 59953ee728fc870866f831637b795eef ‘:’ 12345678B '}

Redmine Admin wrote:

yes, it should be ‘59953ee728fc870866f831637b795eef’:‘12345678B’ for additional fields

David Saenz wrote:

Redmine Admin wrote:

yes, it should be ‘59953ee728fc870866f831637b795eef’:‘12345678B’ for additional fields

Well, I keep saying that the ‘document’ field is mandatory.
This is the request.

General
Request URL: https://user-api.simplybook.me/
Request Method: POST
Status Code: 200
Remote Address: 158.69.26.11:443
Referrer Policy: no-referrer-when-downgrade

Response header
access-control-allow-headers: content-type, x-company-login, x-application-token, x-user-token, x-token, x-requested-with
access-control-allow-methods: POST, GET, OPTIONS
access-control-allow-origin: *
content-length: 120
content-type: application/json; charset=UTF-8
date: Mon, 22 Oct 2018 15:17:51 GMT
server: nginx
status: 200
x-xss-protection: 1; mode=block
Provisional headers are shown

Request header
Accept: application/json, text/javascript, /; q=0.01
Content-Type: application/json
Origin: http://dev.etronroom:3000
Referer: http://dev.etronroom:3000/booking?treatment=Sr&name=David&surname=Saenz&phone=654654654&document=38138131B&email=david%40herokidstudio.es&companions=2
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
X-Company-Login: audietrontest
X-Token: f3d265a8ea362de72041bdcd764f91b236db8922d76c67343ff025fea5c33edd

Request payload
{jsonrpc: “2.0”, method: “book”, params: [1, 1, “2018-10-23”, “10:00:00”,…], id: 4}
id: 4
jsonrpc: “2.0”
method: “book”
params: [1, 1, “2018-10-23”, “10:00:00”,…]
0: 1
1: 1
2: “2018-10-23”
3: “10:00:00”
4: {name: “Sr Lorem ipsum”, email: “lorem@ipsum.com”, phone: “654654654”, require_confirm: true,…}
59953ee728fc870866f831637b795eef: “12345678B”
email: “david@herokidstudio.es”
name: “Sr David Saenz”
phone: “654654654”
require_confirm: true

Redmine Admin wrote:

additional params must be passed as array

David Saenz wrote:

Redmine Admin wrote:

additional params must be passed as array

Please, can you show me and example?

Redmine Admin wrote:

on php it should looks like

$client->book(40, 1, 1, 2, "2019-09-08", "13:00", null, null, 0, array('e28064f09a75d91c503f81a0cda3f71e'=>'field 1 data', 'fa23c732e6a0b3caf9aa29b7909b1a44'=>'field 2 data'));