API to validate Manufacturing Order

Hello Guys i have an issue with MO API, i have managed to create MO (using POST call), now im trying to validate the created MO im getting Error 500 (Internal server Error:BadStatus) below are my Request and Response.

---------Request-----------
{
“entity”: 1,
“status”: 1,
“date_creation”:“1661178261”,
“tms”:“1661178261”,
“fk_user_creat”:“1”
}

--------Response--------
{
“error”: {
“code”: 500,
“message”: “Internal Server Error: BadStatus”
},
“debug”: {
“source”: “api_mos.class.php:245 at call stage”,
“stages”: {
“success”: [
“get”,
“route”,
“negotiate”,
“authenticate”,
“validate”
],
“failure”: [
“call”,
“message”
]
}
}
}

Never worked with the API, but:

  1. First you must create a draft i.e. with status 0
  2. You must add lines to MO. You CAN NOT validate an empty MO i.e. without any lines. (same is valid also for proposals, orders, invoices, etc.)
  3. To validate you have to set date_valid before validation.

Also, check the user permissions. If you are using extended permissions make sure it has the rights to validate. Otherwise, write permissions should be enough.

@milenmk Thanks for sharing,

Now here the issue is i have created the draft MO with lines already, using the available post API though it seemed to have few issues. so i only need to validate and consume products…

User permissions are also OK, this user is a super admin, and i have enabled all the rights.

also even if i put validation date on the PUT API i’m still getting the same error.

Hello.
did you solve this?
I have the same problem.

sorry for my English!

Hi @Pelao ,

I did not get a clean solution for this, I am planning to use DB trigger to change status after creating the MO using the POST API.

I am not experimenting on the consume/produce API, which is also giving some unwanted response.

Regards …

Hi Masino.
Ah ok. how do you do with the mask? MO22…

Thnks

@Pelao
the mask at which stage??