How to programatically add fields and then import data

Hello all

Two questions :

1 Does the documentation at https://docs.suitecrm.com/developer/appendix-b-api-methods/ relate to v4 or V8 (not v8 as that is now deprecated) of the REST API?

2.1 How can I programtically add fields to a module, something similar to the get_module_fields REST endpoint but a set_module_fields?
2.2 Can I use the set_entries REST endpoint to do bulk import of data?

Kindest

That is about v4.1

I created an issue to move it to inside the v.4.1 chapter, so it becomes clearer.

Are you using V8?

@pgr yes V8 (7.11.10)
Do you have any thoughts on questions 2.1 and 2.2?

Sorry, I really don’t know much about the API, never used it.

About the bulk import - any reason why you would want to do this through the API? If it’s just a one-time, initial import, I would do it more directly, via SQL to the database, or if it’s more structured and nuanced, through an import script which runs as a custom entrypoint and uses Beans to write data.

An example here:

–> https://gist.github.com/pgorod/3ce7868a290df0ef4f8c9de74f12a6cd

Thanks @pgr for the sample code to programmatically import data.

Does anyone have ideas (or even some code) to programmatically create fields, other than doing it in Studio.

Much appreciated.