Deploy both .html embedded form and .bpmn model using rest API - camunda

according this article its possible to deploy both bpmn model and its embedded form with camunda API requests. the problem is that I dont want to use curl tools. I need to deploy both .bpmn model and .html form files with statndard camunda API post method .
I’ve ever do this to deploy my .bpmn model with generated forms type. but righ now I want to deploy embedded forms (as a seperate .html file). now, how can i upload both of these files with rest API?
( I know that i should use ‘embedded:deployment:sampleEmbeddedForm.html’ in modeler form key)
In addition, I use postman to test these rest APIs.
I would be very grateful if you could help me.

according to help of a friend that the answer is posted here, its possible by adding a new body parameter, as name as form name.

Related

How to build API that will return HTML for the site and JSON for other clients

I have started learning DRF just a while ago and had a little question -
how can I code one API that will return HTML for the site that I am currently working on and return JSON format for other "clients"(e.g. mobile apps, desktop, etc)?
I have tried to search for this information, but didn't found any answering content.
The only way I see is to create default Django views for the site and create separated API's for other requests. Can anybody tell me if I am right and need to do so, or there is some code that is solving my problem?
Ultimately, you can think of it as a whole separate set of views, urls and instead of models you have a serializer. Within you're app you can create an API folder. Within that directory you will need to have an '_ _ init _ _.py', 'urls.py', 'views.py' and a 'serializers.py'. Its analogous to creating a standard url, view, model structure to display an HTML page, but without the HTML template. Make distinct urls for the serializers too. For example for login do something like this:
path('my_app_api/login', serializer_view)
Youtube has tons of videos if you search django rest framework

Where is my "raw data & HTML form" option in django rest api?

Hellow developers,
I started using django rest framework, but I am not able to see raw data/ HTML form options in my post request user interface. My dhango and rest framework versions are latest.
The whole API works fine when I insert the data as json inside the content textarea, but I would like to have another options as well.
Found the answer
using decorators (#api_view) will not generate those ui options,
but using inheritated classes like (APIview) will give you those options.

use django-rest-swagger 2 with custom swagger.json

I have a project build with django-rest-framework, and I want to use django-rest-swagger to get API documentation, so I made a swagger.json file via swagger editor, then my question is:
How can I make django-rest-swagger read and render my own swagger.json instead of auto-generated from code?
I've checked the django-rest-swagger doc over and over again but nothing found about that.
Any comment will be appreciated.
I know this is old post, but I ran into the same issue and wanted to provide my work around.
If you are trying to create a Swagger UI from an external JSON, this was my work around. I am using django but wanted to provide the swagger api of another framework and server. Here are two options:
The simplest solution is to just manually render the swagger html template and insert the endpoint url that provides the JSON inside SwaggerUi(), this is generally located in the last block.
Alternatively, if you cannot access the json directly or have a static file, create your own rest end point that either reads the file, or makes the request to the remote server, and then itself serves up the desired JSON. Reference this endpoint in your swagger template.

What is the preferred layout when dealing with apps using DjangoRestFramework for a ReSTful API?

According to this StackOverflow post: DjangoRestFramework - How do I customize the frontend?
it says "Typically you want to put your DjangoRestFramework REST Api in something like /api". I'm not sure what this means, so I did some more browsing.
In this GitHub project: https://github.com/kevinastone/django-api-rest-and-angular there is an /example/ folder and inside the folder there is a folder called /api/ which has api.py and serializers.py. I've never come across a tutorial which ever told me to create an api.py file and to place an /api/ folder inside the app (it looks like the app is called "example" in the GitHub project).
I've watched this tutorial: https://godjango.com/41-start-your-api-django-rest-framework-part-1/ and it seems as if the instructor created an app called "api" which has serializers.py and urls.py. With that said, different tutorials show different things. What's the preferred way of creating a Django app which uses the DjangoRestFramework for a ReSTful API?
My end goal is to create a Django app with DjangoRestFramework and AngularJS on the frontend.
I'm sure you've already figured this out, but for other people that stumble upon this he's including his api as it's own django 'app', just like in the tutorial you mentioned. His file "api.py" is basically, for all intents and purposes, serving as what most tutorials call "views.py". But as it is where he declares the methods for his api, and not the applications views, calling it "api.py" is clear cut and makes sense. Doesn't matter what you call it so long as it's imported and used appropriately. The best way to make a rest framework is to use paths that are reflexive of their use case. 'api/post_images' for instance, would post an image and not post a comment or retrieve a user's profile information.
If you only have one rest api call, you may not be interested in holding your single api method in it's own designated file. But as your application grows the use this convention will prove its value.

Django Rest_Framework File upload using Ajax

I'm beginner of django rest_framework.
I want to implement file upload feature to my project,
and I did some search, but I could not get any helpful example.
So, is there somebody who can tell me some reference or example in rest framework file upload?
Uploading a file using Django Rest Framework can be done independently from the method that you are using to send the request (Ajax in this case).
You can follow this to have more information about how it is done