When creating an API Notebook with a hyphen seperated resource name "/songs-list" on RAML 1.0 , API Platform 2.0, it gives the below error : APINotebook Error
API.createClient('client', '9c2861a1-b**b-401e-****-1ec*****b20c', 'testhyphen', '1.0.2');
$0=Client has been successfully created
client.songs-list.post[{"msg":"succ"}];
$1=ReferenceError: list is not defined
at eval (eval at <anonymous> (eval at value (https://cdn.anypoint.mulesoft.com/artifacts/exchange-ui/main.efc15523965187f6c807.js:1:998504)), <anonymous>:1:14)
at Object.eval (eval at value (https://cdn.anypoint.mulesoft.com/artifacts/exchange-ui/main.efc15523965187f6c807.js:1:998504), <anonymous>:3:8)
at e.value (https://cdn.anypoint.mulesoft.com/artifacts/exchange-ui/main.efc15523965187f6c807.js:1:998611)
at https://cdn.anypoint.mulesoft.com/artifacts/exchange-ui/main.efc15523965187f6c807.js:1:2212756
at h.run (https://cdn.anypoint.mulesoft.com/artifacts/exchange-ui/main.efc15523965187f6c807.js:1:282445)
at p (https://cdn.anypoint.mulesoft.com/artifacts/exchange-ui/main.efc15523965187f6c807.js:1:281939)
at nrWrapper (https://anypoint.mulesoft.com/exchange/9c2861a1-b**b-401e-****-1ec*****b20c/testhyphen/minor/1.0/:1:24554)
RAML of the above asset is as below with reource name "/songs-list":
#%RAML 1.0
title: testhyphen
/songs-list:
post:
body:
application/json:
responses:
200:
body:
application/json:
example: {"messgae": "Success"}
If the resource name does not contain "-" (hyphen), eg when resource is - "/songs", then the API notebook runs as expected. API Notebook success
API.createClient('client', '9c2861a1-b**b-401e-****-1ec*****b20c', 'testset', '1.0.1');
$0=Client has been successfully created
client.songs.post[{"msg":"succ"}];
Code snippet executed with no results
You can use this format to run it successfully:
clients['songs-list'].post[{"msg":"succ"}];
Without that format, it sees the hyphen as a subtraction operator. Since APINotebook runs on JavaScript, and supports any JavaScript syntax, you can look up how to do things in JavaScript and they should work with APINotebook.