My current Problem is: i need to be able to perform the following call:
https://{Net-IP}:{Net-Port}/rest/devices/{deviceName}.{deviceID}
First of all defining a host variable such as:
host: {Net-IP}:{Net-Port} is not possible.
Second, if i then try to implement the Path-Parameter in the paths such as:
/devices/{deviceName}.{deviceID}/measurePoints:
get:
summary: Method returns list of measure points
parameters:
- name: deviceName
in: path
type: string
required: true
description: device Name
- name: deviceID
in: path
type: string
required: true
description: device ID
then it says Path templating is not allowed.
I need this type of calls to be translated for Postman, i appreciate your help!
Why don't you make use of environmental variables/constants etc.
Related
I am developing a reusable workflow using Javascript actions by following this tutorial. My action.yml looks like this.
name: "Test"
description: "Reusable workflow"
inputs:
input-one:
required: false
type: string
runs:
using: 'node16'
main: 'dist/index.js'
But my question is how to access the secrets in dist/index.js?. Please note that I don't want the user to supply the secret as input, I would like to store the secret in my reusable workflow repository and use it whenever it's needed.
I tried to change the action.yml with env(So that I can use node process.env API to get the secret) but it's failing with an error saying that Unexpected value 'env'.
name: "Test"
description: "Reusable workflow"
inputs:
input-one:
required: false
type: string
runs:
using: 'node16'
main: 'dist/index.js'
env:
DUMMY_VAL: ${{ secrets.MY_REPOSITORY_SECRET }}
I don't think that's possible. That would be somewhat a security vulnerability.
Examples clearly show that secrets have to be explicitly passed https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow
You can experiment with default value for it but looks like it's not supported for workflows.
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_callsecrets
It would look like this (probably won't work):
on:
workflow_call:
secrets:
access-token:
description: 'Your secret'
required: false
default: ${{ secrets.your-secret }}
If it doesn't work you can try suggesting it as a feature here: https://github.com/orgs/community/discussions/categories/actions-and-packages
On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. In the "Security" section of the sidebar, select Secrets, then click Actions. Click New repository secret.
Credit: Google
I'm learning full stack development and on this project I'm working on I have a schema with the following:
var questionSchema = new mongoose.Schema(
{
language: String,
precedence: [String],
body: [{
answer: String,
correction: Number,
mandatory: Number,
eliminative: Number,
points: Number
}],
type: String,
});
After initiliazing the connection to the server, I use Postman to try things out and whenever I do a POST, the "precedence": will always come before the "_id":. I had the same happening with the "body": but somehow i fixed it. It doesn't matter if the array is empty or not, it will still be on top. I'm going to start with my front-end development now, something I'm completely new to, and I have no idea if this is an error that can cause problems further ahead. How can i fix this?
I am using this: https://www.npmjs.com/package/youtube-notification to get new uploads for my discord bot.
I'm not sure what to put for the urlCallback section?
This is the example code:
const notifier = new YouTubeNotifier({
hubCallback: 'https://example.com/youtube',
port: 8080,
secret: 'Something',
path: '/youtube'
});
notifier.setup();
I think, the documentation for the package makes it pretty clear
Quoting it
YouTubeNotifier.constructor(options)
options is an object that you may write your own properties to. The following properties are read by YouTubeNotifier:
hubCallback - Your ip/domain name that will be used as a callback URL by Pubsubhubbub. It must be in a URL format, ex: 'https://example.com/'. This is a required property as the default is undefined.
So basically your callback will be your localhost kinda thing, where the server will get data from. If you have let's say on a Repl in Repl.it, then it will have to get the data from the Repl hosting URL
I am working on a NativeScript app with Firebase. I have to display featured elements based on their status in the firebase array object. The status is
featured= true.
I want to filter directly in my function's url using query params (That's without using Headers in the http request).
Here is a sample of the firebase data structure
dishes
0
category:
"mains"
comments
description:
"A unique combination of Indian Uthappam (pancak..."
featured: "true"
id: 0
image: "https://www.inspiredtaste.net/wp-content/upload..."
label: "Hot"
name: "Uthappizza"
price: "4.99"
and here is my typscript angular based method:
getFeaturedDish(): Observable<Dish> {
return this.http.get<Dish[]>(baseURL + 'dishes.json' /**query placeholder */).pipe(map(dishes => dishes[0]))
.pipe(catchError(this.processHTTPMsgService.handleError));
}
To filter your structure on featured being "true", you'd use:
dishes.json?orderBy="featured"&equalTo="true"
Don't forget the double quotes around "true" as you are storing a string value, and not a boolean.
Also see the Firebase documentation on filtering data with the REST API.
I'm building a server in Node.js that receives data from Javascript on a website. The data is being sent using jQuery's getJSON method, like so:
$.getJSON(
url,
{
id: track.id,
artist: track.artist,
title: track.title,
album: track.album,
filename: track.filename,
user: track.user,
userId: track.userId,
room: track.room,
timestamp: track.timestamp
}
);
I'm then trying to get at the data using Node's url module like this:
var urlObj = url.parse(request.url, true);
var jsonCallback = urlObj.query["callback"];
This works fine most of the time, but it fails when one of the parameters contains an apostrophe. It looks like it's stopping parsing the query string at the apostrophe. Here's what console.log prints for two different query objects:
{ callback: 'jQuery15105242477038409561_1304925579219',
id: '6c91c74db064c93f1f020000',
artist: 'Radiohead',
title: 'Everything In Its Right Place',
album: 'Kid A',
filename: '01 Everything In Its Right Place.m4a',
user: 'Cowrelish',
userId: '82a89b4df7a9120305000000',
room: 'qwantz',
timestamp: '1304924972555',
_: '1304925611362' }
{ callback: 'jQuery15105242477038409561_1304925579221',
id: '798cc74dfcce4337f7010000',
artist: 'Toy Dolls',
title: 'The Final Countdown',
album: 'HOLY SHIT!!! IT' }
The album for the second one is "HOLY SHIT!! IT'S THE FINAL COUNTDOWN!", as you can see it's been truncated at the apostrophe.
I've tried escaping the apostrophe in the client code, but all I get then is "album: 'HOLY SHIT!!! IT\\'". It's escaping the slash, but not the apostrophe.
Is this a bug or a feature? Should I be escaping apostrophes in a different way on the client, or looking to fix a bug in Node.js?
You shouldn't have to escape on the jquery side, and it doesn't appear to be a node bug (at least with latest release).
I tried to duplicate your problem and wasn't able to using node 0.4.7.
I did this:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$.getJSON('/', {test:"it's a test"});
});
</script>
with node code that just did this on the incoming request:
console.log(require('url').parse(req.url, true));
which gave me:
{ test: 'it\'s a test' }
So, doesn't seem to be a general problem with either jQuery or node.
Have you looked at the full url before it is parsed? You should be able to just copy and paste that into the node interactive shell and do something like this to test:
require('url').parse('http://www.example.org/?q=it\'s working', true);
Anything between the browser and the web server that might be touching the url?