Skip to content
Get started

Add Media Item (Photo)

client.mediaitem.create(MediaitemCreateParams { chargePointID, imageDataBase64, comment } body, RequestOptionsoptions?): MediaitemCreateResponse { status, description }
POST/mediaitem

Submit a photo for a specific charging location

ParametersExpand Collapse
body: MediaitemCreateParams { chargePointID, imageDataBase64, comment }
chargePointID: number

ID value for the OCM site (POI) this image relates to.

imageDataBase64: string

BASE64 encoded data

minLength1
comment?: string

Optional description of image or context

minLength1
ReturnsExpand Collapse
MediaitemCreateResponse { status, description }
status: string

status code OK

description?: string

Add Media Item (Photo)

import Ocm from 'ocm-sdk';

const client = new Ocm({
  bearer: process.env['OCM_USERNAME'], // This is the default and can be omitted
});

const mediaitem = await client.mediaitem.create({
  chargePointID: 1234,
  imageDataBase64: 'data:image/jpeg;base64,<BASE64_ENCODED_DATA>',
  comment: 'An example comment',
});

console.log(mediaitem.status);
{
  "status": "OK",
  "description": "OK"
}
Returns Examples
{
  "status": "OK",
  "description": "OK"
}