Rest API Post Request

Not really, I understand the idea, but I don’t know the code to put in the action, and how to put my data.

Is it possible to call action « action-group-supplychain-saleorder-onnew » and put my data from JSON?

how you are trying so far ?
i am assuming you want to call it from mobile or other system

I want to call it from an other application.
I try with API, but not with Method because I don’t know how to send data from my application to the Action.

The only thing I want is to create an order with data from my application. So maybe it is possible to call action « action-group-supplychain-saleorder-onnew »?

can you share how did you try? i meant code snippets, i will share how to do it via method

Thank you for your response and the time you are taking.
I don’t understand what I have to do.
I have an application that allows me to send an http PUT request to Axelor, with data in JSON.

But via a Method request I don’t know what to call, nor how to pass the values to create the sales order.

For example, via postman how to create a sale order?

That depend how you wrote you controller.
If you can send a snippet how you code for the Sale Order is written would be easier.
Anyway you have to respect the DTO structure

I don’t wrote a controller, do you have example?

Is it possible to call the « action-group-supplychain-saleorder-onnew » from postman with data into body, looking like:

{

  "data": {

    "company":"XXX",

    "clientPartner":"T0010 - Client test",

     "saleOrderLineList":{

        "product": "[123.456] Produit test",

        "productName": "Test api",

        "price":"19.99",

        "attrs":"{\"Test\": \"test\"}",

        "unit":"Unité",

        "qty":"66"

    }

  }

}

it’s quite possible but you have to follow full flow and have data accordingly

that’s why said the other way

So I don’t understand what is the other way.

Do you understand what I would like to do?

Hello @Jeanguy
In order to call this action « action-group-supplychain-saleorder-onnew »
You need to execute more actions in 1 single action because that action is an action group.

Basically what @siddique is saying you need to create a JSON object that follows your sale order structure.
Then POST a new request on your server. (After being properly authenticated)

Hi,
I have made some progress on my problem.
To create a saleOrder we can make a PUT request :

https://xxxxx.xx:8080/ws/rest/com.axelor.apps.sale.db.SaleOrder

with these paramters:

{

    "data": {

        "mainInvoicingAddressStr": "Rue test API",

        "statusSelect": 3,

        "firstName": "Smith",

        "company": {

                "id": 1

            },

        "creationDate": "YYY-MM-DD",

        "salemanUser": {

            "id": 2

        },

        "externalReference": "Test api 4 Postman",

        "stockLocation": {

            "id": 1

        },

        "clientPartner": {

            "id": 12

        },

        "currency": {

                "id": 46

        }

    }

}

Get the id of saleorder into response, and then, make a PUT request for line:

http://xxxxxx.xx:8080/ws/rest/com.axelor.apps.sale.db.SaleOrderLine

with parameters:

{

    "data": {

            "toInvoice": false,

            "typeSelect": 0,

            "isQtyRequested": false,

            "productName": "Test ligne API 4",

            "invoicingDate": null,

            "supplierPartner": null,

            "price": "99.9900000000",

            "inTaxTotal": "11998.80",

            "exTaxTotal": "9999.00",

            "inTaxPrice": "119.9880000000",

            "priceDiscounted": "99.9900000000",

            "taxLine": {

                "id": 35

               },

            "billOfMaterial": {

                "id": 4

            },

            "desiredDelivDate": null,

            "sequence": 0,

            "unit": {

                "id": 1

            },

            "qty": "100.00",

            "saleOrder": {

                "id": ID from previous saleorder

            },

            "companyCostPrice": "0.00",

            "product": {

                "id": 6

            },

            "saleSupplySelect": 3,

            "standardDelay": 1,

            "createdBy": {

                "id": 2

            }

        }

}

I think I have to add « companyExTaxTotal », « taxTotal » and « inTaxTotal » into request for saleorder

2 « J'aime »

Hello
Seems ok ! Good

@daryl . Have you tried the Advanced Rest Service ??. If yes have you come across the 403 issues using POST . Like you did with the normal REST API, i tried with PUT that it didn’t work. I got a 405 error