JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
const credential = await client.credentials.packages.credentials.create('x', {
credentialName: '26f1kl_-n-71',
fields: [{ fieldType: 'email', value: 'x' }],
});
console.log(credential.data);import os
from mobilerun_sdk import Mobilerun
client = Mobilerun(
api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"), # This is the default and can be omitted
)
credential = client.credentials.packages.credentials.create(
package_name="x",
credential_name="26f1kl_-n-71",
fields=[{
"field_type": "email",
"value": "x",
}],
)
print(credential.data)curl --request POST \
--url https://api.mobilerun.ai/v1/credentials/packages/{packageName} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"credentialName": "<string>",
"fields": [
{
"value": "<string>"
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/v1/credentials/packages/{packageName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'credentialName' => '<string>',
'fields' => [
[
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mobilerun.ai/v1/credentials/packages/{packageName}"
payload := strings.NewReader("{\n \"credentialName\": \"<string>\",\n \"fields\": [\n {\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mobilerun.ai/v1/credentials/packages/{packageName}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credentialName\": \"<string>\",\n \"fields\": [\n {\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/v1/credentials/packages/{packageName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credentialName\": \"<string>\",\n \"fields\": [\n {\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"createdBy": "<string>",
"credentialName": "<string>",
"fields": [
{
"fieldType": "email",
"value": "<string>"
}
],
"ownerId": "<string>",
"packageName": "<string>",
"secretPath": "<string>",
"userId": "<string>"
},
"message": "<string>",
"success": true
}App Credentials
Create a credential
Creates a credential under the given package with a credentialName and at least one field. Each field has a fieldType (email, username, password, api_token, phone_number, two_factor_secret, or backup_codes) and a value.
POST
/
credentials
/
packages
/
{packageName}
JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
const credential = await client.credentials.packages.credentials.create('x', {
credentialName: '26f1kl_-n-71',
fields: [{ fieldType: 'email', value: 'x' }],
});
console.log(credential.data);import os
from mobilerun_sdk import Mobilerun
client = Mobilerun(
api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"), # This is the default and can be omitted
)
credential = client.credentials.packages.credentials.create(
package_name="x",
credential_name="26f1kl_-n-71",
fields=[{
"field_type": "email",
"value": "x",
}],
)
print(credential.data)curl --request POST \
--url https://api.mobilerun.ai/v1/credentials/packages/{packageName} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"credentialName": "<string>",
"fields": [
{
"value": "<string>"
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/v1/credentials/packages/{packageName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'credentialName' => '<string>',
'fields' => [
[
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mobilerun.ai/v1/credentials/packages/{packageName}"
payload := strings.NewReader("{\n \"credentialName\": \"<string>\",\n \"fields\": [\n {\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mobilerun.ai/v1/credentials/packages/{packageName}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credentialName\": \"<string>\",\n \"fields\": [\n {\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/v1/credentials/packages/{packageName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credentialName\": \"<string>\",\n \"fields\": [\n {\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"createdBy": "<string>",
"credentialName": "<string>",
"fields": [
{
"fieldType": "email",
"value": "<string>"
}
],
"ownerId": "<string>",
"packageName": "<string>",
"secretPath": "<string>",
"userId": "<string>"
},
"message": "<string>",
"success": true
}Authorizations
Bearer token via Authorization header
Path Parameters
Required string length:
1 - 200Body
application/json
Was this page helpful?
⌘I