Creating Form Using Persistence REST API Error 400.

8 views
Skip to first unread message

Joel Oates

unread,
May 27, 2019, 7:51:49 PM5/27/19
to orb...@googlegroups.com
Hello!

We have been using the Orbeon persistence API to create forms using
templates we have created.

Firstly, I am creating a template, and publishing it. I then am trying to
use the API to create a form using that template. My template details are as
follow.

Application Name: Test_Form
Form: Test_Form

The content of the template is just a simple input. Now I want to create a
new form with that template with the following

Method: PUT
URL:
http://localhost:8080/orbeon/fr/service/persistence/crud/Test_Form/Test_Form/data/123/data.xml
Content-Type: application/xml

Body:

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
fr:data-format-version="4.0.0">
<section-1>
</section-1>
</form>

When I do this I get an error 400 back. The funny thing here is that this
same call used to work.. I don't get any errors in the logs, I just get a
400 back.

I have tried wiping my database (Drop Database and recreating it)
Doing a very simple example (The on above)

Any idea on whats going on here?

Thanks,
Joel.

--
Sent from: http://discuss.orbeon.com/

Joel Oates

unread,
May 27, 2019, 8:36:36 PM5/27/19
to orb...@googlegroups.com
I have found the issue here, It was to do with my versioning header,

I had 'Orbeon-Form-Definition-Version: 2 (Copied from the Documentation)
Instead I should have had Orbeon-Form-Definition-Version: 2

The reason this would have worked the first time, is because there was no
other forms (I guess?)

Thanks Anyway!

Alessandro Vernet

unread,
May 29, 2019, 1:16:17 PM5/29/19
to orb...@googlegroups.com
Hi Joel,

I'm glad it's working for you now. But for those finding this thread, what
was the change to the header? (In your message, you're saying "I had X.
Instead I should have had X", but X is the same in both cases.)

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Joel Oates

unread,
Jun 30, 2019, 11:04:12 PM6/30/19
to orb...@googlegroups.com
Hey Alex,

Sorry for the late reply, I had a quote mark in the header name so it wasn't
being picked up. Sorry not that noticeable in my reply.

I have a little follow up query here, I am trying to get the form using the
persistence API the with following link

http://localhost:8080/orbeon/fr/service/persistence/crud/Coding-Workflow/Coding-form/form/form.xhtml

I currently have 2 versions of this form, I want to get the first version of
this form. so I tried to use

http://localhost:8080/orbeon/fr/service/persistence/crud/Coding-Workflow/Coding-form/form/form.xhtml?Orbeon-Form-Definition-Version=1

but I still get the 2nd published version of the form, in fact no matter
what I am put as a header number I still just get the 2nd version of the
form.

any idea why my header is being ignored?

Thanks for your time
Joel.

Alessandro Vernet

unread,
Jul 1, 2019, 1:33:09 PM7/1/19
to orb...@googlegroups.com
Hi Joel,

`Orbeon-Form-Definition-Version` must be a request header, not a request
parameter. You'll let me know if using a request header you're getting the
correct form definition. (Also if you have to debug another 400 error like
this in the future, you should find information about what's going on in the
`orbeon.log`.)

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Joel Oates

unread,
Jul 2, 2019, 11:46:31 PM7/2/19
to orb...@googlegroups.com
Hey Alex,

Thanks for the reply, Thank you for that! that did work! Works correctly
getting the correct version and a 404 if i try get a version that doesn't
exist! (as expected!)

Thanks again,
Joel.

Alessandro Vernet

unread,
Jul 3, 2019, 2:04:51 PM7/3/19
to orb...@googlegroups.com
Perfect Joel, I'm glad it's now working when setting the form version with a
header, and thank you for the confirmation.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply all
Reply to author
Forward
0 new messages