How can I submit a checkbox field using Rest Service?

I am new to this system. I would like to send a checkbox type field to another system using REST SERVICE. I’m trying but it always gives me an error.

Hi @viperboys can you please send me a private message with the following details so that I can take a look:

  • Server (OCHA/HHI)
  • Username
  • Project name

Hi my project name is only a test… Is it necessary to send all this data? I am sending a lot of data to other systems through Rest service. The only data that I need to send is the checkbox. I still can’t find a way to send it.

My project name is: xxxxxxx

Hi @viperboys, I will need those three pieces of information if you would like me to take a look.

I’m unsure what the issue with the checkbox is that you are referring to, so it will be easier if I can see it and test it out.

1 Like

Hi @Josh Sorry but I can’t share credentials due to company policy.
I will share a video of what I am trying to do.

Video: Loom | Free Screen & Video Recording Software

In this example I do not send a checkbox type field or a file type field. What I want is to know how is the correct way to send a check box type field and file type fields. As you can see in the video. IN the option REst Service there is no configuration. I just added the end point.

Thank you Josh…

Hi @viperboys, thank you for sending the video link.

Can you please clarify what you mean exactly by a “check box type field”? I have tested with select_one, select_multiple and acknowledge types and they all seem to work fine. As I mentioned in Sending files to other systems via Rest API - #4 by Josh, you are only able to send JSON or XML with the REST Service and not media files.

1 Like

Hi @Josh
I mean select_multiple. I am trying to submit it and I am getting this error.
{“code”:“not_created”,“message”:“Entry was not created because no values were mapped to fields.”,“data”:null}

Then I want to know how is the correct way to send these fields.

Hi @viperboys, thanks for clarifying. It seems as though the issue is likely on the side where the data is being consumed, rather than the REST Service not sending it.

Can you try following the example in the support docs here:

https://support.kobotoolbox.org/rest_services.html

And use beeceptor to see what the REST Service gives you — then see if your fields are being mapped correctly in the application you’re using.

2 Likes

Hi @Josh
Is there a way to customize the JSON? I realize that the JSON is created this way.
{"_id": 178707382, “_notes”: [], “_validation_status”: {}, “_uuid”: “78f17fde-5e99-4f44-b009-f6d2f3dd7338”, “_tags”: [], “_submitted_by”: null, “_xform_id_string”: “ak5B2yjZLQ7k5QRXCBHiYf”, “Nombre”: “Subrato”, “meta/instanceID”: “uuid:78f17fde-5e99-4f44-b009-f6d2f3dd7338”, “formhub/uuid”: “5c97a552ae82451c8134948baef749a8”, “end”: “2021-05-19T16:07:41.259-04:00”, “Opciones”: “option_1 option_2”, “_submission_time”: “2021-05-19T20:07:52”, “_attachments”: [], “start”: “2021-05-19T16:01:29.922-04:00”, “_geolocation”: [null, null], “_status”: “submitted_via_web”, “version”: “v8wGTyikVtigEwznYnbihL”}

The “Select several” field is sent this way
“Opciones”: “option_1 option_2”
This is lost when I have it on my other system. It would be ideal if it was sent this way

“option_1”:“option_1”,
“option_2”:“option_2”

Is this possible?

Hi @viperboys, unfortunately this isn’t possible without making changes on our end. If that’s the only format that you’re able to consume, you’ll have to process the data before it reaches your WordPress application using something like Lambda or similar.

1 Like