Deploy app settings

Hi everyone
There’s a problem I’m facing:

I deploy app settings by using API (the same as clicking on “Update app” button ),
I can’t post a record right after that, It displays some errors. I think the reason is the app deploy status being “PROCESSING”.

How should I do ?

Hello Tom,

What kind of error does it display?

A screen shot would be very helpful.

 

Thank you,

Yasu

Hello Yasu

Thanks for your response

The error implies that I can’t post a record.
that’s because the app wasn’t deployed successfully.
If I wait in about 10s (I guess the app was deployed successfully at this time) then I post that record again , it works properly

one of field types of a record I want to post is ‘MULTI_SELECT’(multi-choice),
before we can post data to this field type, those data must be set as option values.
that’s why I need to post some data to this field type , then deploy app (both of actions were performed by using API)
and finally I post the record.

A silly way that can help me solve this problem is using setTimeout() function to stop executing code in 10s (I think the time is enough to deploy app successfully )

But I want to find more useful solutions

Thank you,

Tom

The deployment of the app setting, which is the execution of “/k/v1/preview/app/deploy” and the completion of the App update, takes some time.

The followings API allows you to check the deployment status of the App settings.

 

URL https://{subdomain}.kintone.com/k/v1/preview/app/deploy.json 

URL(guest space) https://{subdomain}.kintone.com/k/guest/{SpaceID}/v1/preview/app/deploy.json 

▼ Get App Deploy Status 

 https://developer.kintone.io/hc/en-us/articles/115004890947-Get-App-Deploy-Status

The deployment process could take more than 10 seconds, so you might want to set up the API to check the status of the App settings in the above link to the production environment. And once the App update is complete, your code can be processed.

Hope it helps.

Thanks.

Junko

Hello Junko Werner

I tried using the API you mentioned above,
but the status of the deployment of App settings is always " PROCESSING", not be " SUCCESS".   

How should I do ?  

Thanks
Tom

Hi Tom,

Your “always” means even though the deployment has completed like in 10 seconds , is the status of the deployment “PROCESSING”?

Thanks.

Junko

Hi  Junko Werner

No, in 10 seconds, It will change from ‘Processing’ into ‘Success’.
so I need a loop like this:
do{

// some code to get the deployment status of app settings

}while(status === “Processing” )

after a loop above, the status will be “success”.
Should I do like that?

 

Thanks
Tom

 

Hi Tom,

Ok. So the status changes from ‘Processing’ into ‘Success’ after the completion of the deployment.

This Do While loop might work to get the deployment status of app settings.
However, tons of API might be executed to check the status in this case. Therefore, I think it might be better to include some kind of wait processing in this code to let it run once every 0.5 to 1 second.
There are several ways to create a wait processing, such as using sleep and setTimeout feature, so it’s a good idea to add it to your preference.

Good luck!

Junko

Hi Junko Werner

You mean it might be better to execute the following code.

do{

sleep(10);

// some code to get the deployment status of app settings

}while(status === “Processing” )

 

Thanks
Tom

Hello Tom

I read what you are trying to do in the previous posts.

Yes, the above code will avoid the status check API to run multiple times in a short amount of time; thus, it will prevent from a process overflow or such. Though, the standby time could be much shorter than 10 seconds, 0.5 or 1 seconds like suggested by Junko.

Hello Yuzo and Junko
Thanks for your useful answers