Create rancher secret via API

Hi,
I’m trying to create a rancher secret for all namespaces, via the API (I’m pretty sure you can’t do this via kubectl or rancher CLIs - please let me know if that’s incorrect!).

So far, I’ve got:

curl --insecure -u token-:
–data “data.param1=value1” --data “data.param2=value2” --data “name=global-variable2”
“https:///v3/projects/c-j7dsx:p-98c6s/secrets”

However, I’ve tried a few methods of getting the data into the secret, with no joy. The secret resource is created, but when I do 'kubectl get -o yaml", I get the following:

apiVersion: v1
kind: Secret
metadata:
annotations:
field.cattle.io/creatorId: user-q2crt
field.cattle.io/projectId: c-j7dsx:p-98c6s
lifecycle.cattle.io/create.secretsController_c-j7dsx: “true”
secret.user.cattle.io/secret: “true”
creationTimestamp: 2019-02-26T11:38:02Z
name: global-variable2
namespace: default
resourceVersion: “12185”
selfLink: /api/v1/namespaces/default/secrets/global-variable2
uid: f9491dac-39ba-11e9-b0bd-baeea5553cb1
type: Opaque

As you can see, there is no data there. Can anyone help?

Thanks in advance,
Andy

OK, I got there in the end:

curl --insecure -u
–header “Content-Type: application/json”
–request POST
–data ‘{“name”:“global-variable10”, “data”: {“test”:“dmFsdWUxCg==”, “test2”:“YmFuYW5hcwo=”}}’
“https:///v3/projects/c-j7dsx:p-98c6s/secrets”