Solved

OData REST API how to Invoke an Action?


Userlevel 2
Badge +3

Hello,

I want to prepare some example api calls for REST API.

I created an EntitySet to use CustomerOrderLine functionality like below;

//Dynamic dependency
@DynamicComponentDependency ORDER
entityset CustomerOrderLines for CustomerOrderLine;

Now I can see;

 

I am a bit confused how to use this red marked POST method. How to send body for qty_assigned value? I am sending request but oracle returns me that “QTY_ASSIGNED” is mendatory for CustomerOrderLine…

How can I send the new “QtyAssigned” value to api?

And I looked at the .svc file. there is no attr added with “QTY_ASSIGNED” Value as well.

I am new at REST API. Could you please help me.
Thanks.

icon

Best answer by Rifki Razick 9 May 2022, 09:56

View original

5 replies

Userlevel 4
Badge +9

Hi,

This is a state change action in CustomerOrderLine. Typically state change actions in IFS OData APIs do not accept/require any additional payload. Therefore an empty payload is specified in the POST request (e.g. {})

Have you looked at the Aurena Debug Console when performing the state change in the browser client?

Regards,

/Rifki  

Userlevel 2
Badge +3

Is this really a state change. Ok its behave like a state change method but I got this error as a response:
 

How to use this action then? Unfortunatelly I could not understand still.
So I thought that I need to specify a payload for the request.

 

I have never opened  the Aurena Debug Console yet :)

Userlevel 2
Badge +3

Hi,

This is a state change action in CustomerOrderLine. Typically state change actions in IFS OData APIs do not accept/require any additional payload. Therefore an empty payload is specified in the POST request (e.g. {})

Have you looked at the Aurena Debug Console when performing the state change in the browser client?

Regards,

/Rifki  

 I have never heard states like QtyAssigned or others before,So I confused. Thank you very much for you kind answer. I got it. Now I should look for a post request which accepts a few payload :)

Badge +1

Hi,

As Rifky said above, SetQtyAssigned is related to a state change. For example, when you Reserve Customer Order line, this SetQtyAssigned is used.
 
It's not allowed to update the QtyAssigned (Reserved Qty) directly. Here the value updates via business logic.

Although the name is bit misleading, here the POST SetQtyAssigned is not intended to update the QtyAssigned.

Regards,
Malintha

Userlevel 5
Badge +14

Hi,

 

The topic is already answered. But I want to add detailed information about state change actions.

 

  • First of all, You must know the e-Tag value of the record to state change. You can get an e-Tag value with a GET request. You are going to use it as the header parameter while sending the POST request.

https://url:port/main/ifsapplications/projection/v1/CustomerOrderHandling.svc/CustomerOrderSet(OrderNo='Y1025')

 

  • After that, You must create a POST request and define a header parameter called “If-Match” with the e-Tag value. The body must have empty JSON data.
  • Finally, Send the POST request. It will respond 204 when the e-Tag value and body part are correct.

https://url:port/main/ifsapplications/projection/v1/CustomerOrderHandling.svc/CustomerOrderSet(OrderNo='Y1025')/IfsApp.CustomerOrderHandling.CustomerOrder.SetReleased

 

Note: Don’t forget to remove the “\” characters from the ETag value. They are escape characters.

Example:  

  • W/\"Vy8iQUFBU2c0QUFHQUFBQ25iQUFIOjIwMjAwOTE1MTMyMTUxIg==\"
  • W/"Vy8iQUFBU2c0QUFHQUFBQ25iQUFIOjIwMjAwOTE1MTMyMTUxIg=="

Reply