Creating Form Using Persistence REST API Error 400.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating Form Using Persistence REST API Error 400.

Joel Oates
This post was updated on .
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>
        <control-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/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1559001108127-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Creating Form Using Persistence REST API Error 400.

Joel Oates
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!

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1559003795176-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Creating Form Using Persistence REST API Error 400.

Alessandro  Vernet
Administrator
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
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1559150176197-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Creating Form Using Persistence REST API Error 400.

Joel Oates
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.

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1561950249952-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Creating Form Using Persistence REST API Error 400.

Alessandro  Vernet
Administrator
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
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1562002388408-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Creating Form Using Persistence REST API Error 400.

Joel Oates
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.

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

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1562125589901-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Creating Form Using Persistence REST API Error 400.

Alessandro  Vernet
Administrator
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
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1562177090502-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet