How to create a prism using the API I am surprised at how difficult it is to do elementary things with the  blender api, or at least find the information on the web to do elementary things like lines, texts and in the case, a prism.
So I hope to make a great contribution to the blender community with this question and in general with every question I ask because I'm starting from scratch and I think is the case of many people.
I suspect that the way to do it is through a cube.
Use add primitive cylinder to make a prism

Basically by definition a cylinder in blender is really a regular ngon prism.  Therefore, to add a prism via the UI, simply add &gt; mesh &gt; cylinder with the amount of sides you want the ngon end to have. For example for a triangular prism



This is a simple call to the  operator:

bpy.ops.mesh.primitive_cylinder_add(vertices=3)


change the value of vertices to make other ngons on the ends of prism.

And via the bmesh API with bmesh.ops.create_cone   

Rather than having a create cylinder bmesh has a create cone, which allows us to create a prism by setting the end radii the same.  Simple code to add a triangular prism.

import bpy
import bmesh
context = bpy.context
bm = bmesh.new()
bmesh.ops.create_cone(bm, 
        cap_ends=True, 
        cap_tris=False, 
        segments=3, 
        diameter1=1, 
        diameter2=1, 
        depth=2)
mesh = bpy.data.meshes.new("Prism")
bm.to_mesh(mesh)
prism = bpy.data.objects.new("Prism", mesh)
# link to scene
context.scene.objects.link(prism)