Yes I have my code, I’m only working on authentication and the actual node. I’m simply trying to recreate the API enpoint of the first api from here https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0
//node
import { INodeType, INodeTypeDescription, INodeInputConfiguration, INodeOutputConfiguration } from 'n8n-workflow';
export class MomentumAmp implements INodeType {
description: INodeTypeDescription = {
displayName: 'Momentum Amp',
name: 'MomentumAmp',
icon: 'file:momentumamp.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Get data from Momentum AMPs API',
defaults: {
name: 'Momentum AMP',
},
inputs: [{ type: 'main' } as INodeInputConfiguration],
outputs: [{ type: 'main' } as INodeOutputConfiguration],
credentials: [
{
name: 'MomentumAmpApi',
required: true,
},
],
requestDefaults: {
baseURL: 'https://api.nowcerts.com/api/',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
},
//Required fields
properties: [
{
displayName: 'API Endpoint',
name: 'endpoint',
type: 'options',
placeholder: 'Select an endpoint',
required: true,
description: 'The API endpoint you want to reach.',
options: [
{
name: 'Get Api Token',
value: 'token',
},
],
default: '',
},
],
};
}
//authentication
import {
IAuthenticateGeneric,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class MomentumAmpApi implements ICredentialType {
name = 'MomentumAmpApi';
displayName = 'Momentum Amp API';
documentationUrl = 'https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0';
properties: INodeProperties[] = [
{
displayName: 'Username',
name: 'username',
type: 'string',
default: '',
},
{
displayName: 'Password',
name: 'password',
type: 'string',
typeOptions: { password: true },
default: '',
},
{
displayName: 'Client ID',
name: 'clientId',
type: 'string',
default: 'ngAuthApp', // Default as per API docs
},
];
authenticate = {
type: 'generic',
properties: {
method: 'POST',
url: 'token',
body: {
grant_type: 'password',
username: '={{$credentials.username}}',
password: '={{$credentials.password}}',
client_id: '={{$credentials.clientId}}',
},
},
} as IAuthenticateGeneric;
}